title: Using system() to copy a file (with "cp") never returns?
body: <pre><code>char cmd[256];
  memset(cmd,0,256);
  sprintf(cmd, "cp %s %s", "test1.txt", "test2.txt");
  system(cmd);
  printf("cmd completed\n");
  </code></pre>
  
  <p>When I run the above code, my application hangs at system call. I never get to the printf line. I am running on Linux Centos with GCC compiler.</p>
  
  <p>Any help is appreciated.</p>
  
  <p>If i run the above code in a separate application (copy paste in the main). It runs fine.</p>