title: Can't set file with "echo" from a program via system()
body: <p>I'm try to use system("echo 1 > /sys/class/afile") to set a file to 1. </p>
  
  <p>If I use it on console it works well, but if I run my C program it shows me:</p>
  
  <pre><code>sh: echo: I/O error
  </code></pre>
  
  <p>I already try to set it with following code:</p>
  
  <pre><code>char i[1];
  i[0]=1;
  int fd1 = open("/sys/class/afile",O_CREAT | O_WRONLY);
  int ret = write(fd1,i,strlen(i));
  if(ret &gt; 0)
     printf("Ok\n");
  else
     printf("nOk\n");
  close(fd1);
  </code></pre>
  
  <p>The result is "Ok" but the file didn't change.</p>