954,202 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Closing a test File after writing in it

Hi All.
I am developing a C++ application which has a module to read data from a text file and then write some its data into another text file and then save that.
Everything goes right tilll the last line of the program when I end up writing and try to close the file as follows,

fclose(outFile);


the following error comes out.
General Protection exception
0x24E7:0x54F3
[TEST1]0x24E7:0x54F3 processor Fault

Where test is the name of folder I ahave placed both the files in.
I am using Visual IDE of
Turbo C++
Version 4.5

Thanks.

Masood Ali
Newbie Poster
19 posts since Mar 2007
Reputation Points: 10
Solved Threads: 1
 

Have you corrupted outFile prior to this attempt? The supporting code may contain your answer.

Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 

Well there's nothing wrong with that line, so it must be something else.

My guess is that you've trashed memory somewhere else in your program, and this just happens to be where you find out. It could have crashed at any other line as well, and then no doubt you would have posted that line instead.

To make any real progress of diagnosing the problem, you would need to post the whole program.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You