Originally Posted by DaWei
You ask for help, you get a response, you don't pay attention. Is that nice? Suppose there is no arg1. That pointer is NULL. Do not dereference it with a statement like printf("File1 is %s\n", arg1);. That's invalid. Won't work. Seg fault. Core dump. Slag heap.
But if I type the following this is what I see:
o-shell>exit exit exit
exit was entered
There are 0 arguments
Command is exit
Segmentation fault (core dumped)
There should be two arguments (two exits after the command exit) counted. So the args pointer shouldn't be NULL, unless the strtok code that I entered is wrong...which is what I'm looking for --- the error.