[plug] [OT] segmentation fault
Richard
wpickett at iprimus.com.au
Thu May 30 13:40:03 WST 2002
I know this is a little OT, but it's starting to drive me nuts, so I
hope someone can help. I'm writing a small C program that takes
arguments (file names) off the command-line, prepends a command using
strcat(command, argv[x]), and then creates a pipe to the command and
simply reads in and then prints out the results. When I run the program
I keep getting segmentation fault errors. I have narrowed it down the
the strcat(command, argv[x]) line, but I can't see any problem with it.
Would any kind person like to offer a hint?
The exact line is next = strcat(command, argv[count + 1]);
Where next is an uninitialized char *,command has been initialized to
"ls -l ", and count + 1 is definitely within bounds.
Any ideas would be very welcome.
More information about the plug
mailing list