Hi All,

i'm executing a C program in unix, is there a way i would be able to capture abnormal termination of the C program. i observed that abnormal termintion results in the segmentation fault message being displayed.

Would i be able to capture the return count in Unix to check for successful or abnormal termination?

Also i would like to know, In Unix what are the cases in which C program encounters a segmentation fault/core dump?

Thanks in advance!!

Recommended Answers

All 5 Replies

Also i would like to know, In Unix what are the cases in which C program encounters a segmentation fault/core dump?

I didn't get your earlier question but segmentation fault in UNIX mainly appears in cases of illegal memory access.I mean problem with your pointers.

I'm not sure i fully understand your question either, but if you have a small program it shouldn't be that hard to find an error involving pointers if you show it to someone who is a little more advanced with pointers. If you already are somewhat knowledgeable and the program is much larger, a debugger will be the only way for you to pinpoint your error.

Im not quite sure what you as well, but try the #include<assert.h> or #include<cassert>(c++) you can read about the file here.

I'm scheduling the C program by using a Unix wrapper, C program does file processing.. I need to figure out a way to capture the core dump cos of lot of files are getting processed simultaneosly...

try ferror its part of the stdio library

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.