B
barncat
hi
here is a small snip of code that passes a char array to the excelp func. does anybody know when building the string with strcat(), exec fails? I dont really have an issue, just curious. thanks
--
int main ( int argc, char *argv[] )
{
char cmd[256];
/* for some reason, strcat wont work
strcat(cmd,"ls");
/* these work:
sprintf(cmd, "ls");
strcpy(cmd, "ls");
*/
printf("command: %s",cmd);
execlp(cmd, cmd, NULL);
}
here is a small snip of code that passes a char array to the excelp func. does anybody know when building the string with strcat(), exec fails? I dont really have an issue, just curious. thanks
--
int main ( int argc, char *argv[] )
{
char cmd[256];
/* for some reason, strcat wont work
strcat(cmd,"ls");
/* these work:
sprintf(cmd, "ls");
strcpy(cmd, "ls");
*/
printf("command: %s",cmd);
execlp(cmd, cmd, NULL);
}