Strange Character in Programs Output:
Okay, I was trying to make a simple program to list all the files with a certain termination in a folder of my system (Slackware Linux 9) following the intructions of the book "Linux Application Development by Michael K. Johnson and Erik W. Troan" I got the following piece of code:
Code:
#include<stdlib.h>
#include<sys/wait.h>
int main(){
int result;
result = system("exec ls *.c");
if (!WIFEXITED(result)){
printf("Abnormal termination\n");}
else
printf("%d",result);
exit(0);
}
Okay result is storing perfectly all the names of *.c files but I'm also recieving a zero in the final output here is a sample of the output:
imanewbie@blah:~/Projects/Junk Code$ ./listsc
array.c dinamicstack.c hashtable.c queue.c struct2.c test.c
child.c doublepointer.c linkedlist.c random.c struct.c tripointer.c
conta.c hamash.c listsc.c senha.c swapbytes.c
0
I would like to know if someone can explain me what is this 0 cause the book doesn't mention is and I don't even know what to search for in the internet. Thanks a lot.