From: Oscar F. <of...@wa...> - 2003-05-14 19:59:10
|
"pascal barbedor" <pas...@fr...> writes: > running this simple program below > issues a segfault after completion of program > > program received signal SIGSEGV > > #0 in __do_global_dtors () > #1 in libmsvcrt_a_iname () > > [snip] > char * line ; > printf("%s",fgets(line,200,fp)); fgets does not allocate memory for the input data. You must pre-allocate memory yourself: const int bufferLength = 200; char line[bufferLength]; printf("%s",fgets(line,bufferLength,fp)); -- Oscar |