I'm doing an assignment for school using getop with ocelot, I have to count words and count the substrings in the document. I have the word counting working but I was not able to do the substring, I can only get to read/display what substring the user wants, that's what the program is about. Now, when I put for example on the commandline:
./hello -c -f substringToFind test.txt
it works but that's because the file test exists, if I say for example: ./hello -c -f hd test
it would give me a segmentation fault. How can I read if it was a s. fault and display a message? ex:
if(segmentation fault){
printf("...");
exit(1)
}
Thanks