Reputation: 17
I am getting an error of Aborted on fclose want to know where I am doing wrong. Core Duped:
Stack trace:
Frame Function Args
0022A698 7C802542 (00000758, 0000EA60, 000000A4, 0022A794)
0022A7B8 610DC559 (000007DD, 0000000A, 00000032, 0000000B)
0022A8A8 610D9913 (00000000, 7C801879, 0022FF44, 7C839AC0)
0022A908 610D9DEE (00000144, 00000000, 0022AC30, 00000006)
0022A9B8 610D9F40 (00000288, 00000006, 00000001, 200586E0)
0022A9D8 610D9F6C (00000006, 00000006, 0022AA38, 610FCCE7)
0022AA08 610DA233 (7C809C1B, 00000744, 0022AA68, 610FCE07)
20038678 61110408 (61201C98, 00000000, 20010410, 00000001)
End of stack trace
I am using Cygwin + GCC + Autotools for the project. Didn't understand what that means. After this point nothing is there as the program has to exit but showing Aborted is disturbing..
Upvotes: 0
Views: 3144
Reputation: 754820
One standard way to get a core dump from fclose()
is to pass it a file pointer that's null, because you failed to open the file:
FILE *fp = fopen("/long/hairy/path/with/a/missing/file/at/the/end", "r");
fclose(fp);
Always check the return value from fopen()
and its relatives:
if (fp == NULL)
...report problem
else
{
...use fp...
fclose(fp);
}
Upvotes: 4