-
-
Save chitchcock/5959901 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <process.h> | |
int main(int argc, char *argv[]) { | |
if (argc >= 3) { | |
// call out to cp and use the arguments passed to this program. | |
// We are using P_WAIT so that spawnlp waits for CP to return | |
// The second argument specifies the executable to run | |
// The third-fifth argument will become argv[0] - argv[2] of the executable | |
// The sixth argument indicates that the list of arguments is done | |
// | |
// For more information see http://www.qnx.com/developers/docs/6.3.0SP3/neutrino/lib_ref/s/spawnlp.html | |
int retValue = spawnlp(P_WAIT, "cp", "cp", argv[1], argv[2], NULL); | |
printf("Return value of calling `cp %s %s` is %d\n", argv[1], argv[2], retValue); | |
} else { | |
printf("Please specify two files to copy\n"); | |
} | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment