How to use errno
can any one plz tell me how can you use errno.h functions to display errors (especially the reason of segmentation faults)
|
Re: How to use errno
Quote:
Code:
[baris@rhinox]$ cat perr.c |
On a segfault the errno mechanism doesn't apply.
You use the errno variable and functions after failed systemcalls and after failure of selected library calls. You ned to consult the documentation for individual calls to figure out whether they will use errno to tell you about errors. |
Segfaults are signals from the kernel memory management sub-system.
Nothing more. In order to determine where the problem is you have examine the core file using a debugger like gdb. |
AFIA the only way to examine why a program segfaulted, is using the debugger (gdb).
Either make sure core dumps are enabled (see man bash, search for ulimit) and load the core dump into gdb. Or run the program inside gdb and try to make it segfault. Somtimes a program does not segfault in gdb, while it would when run outside gdb, so the core dump is probably the best option. |
All times are GMT -5. The time now is 08:09 PM. |