New problem...

Started by
2 comments, last by ATronic 22 years, 5 months ago
Hey all, I am having a little problem with file access. I get an access violation in the following lines:
  
FILE *modelFile;
modelFile = fopen(filename, "wb"); //Access Violation Is Here

  
I ran it in debug mode and traced the problem to the memory allocation of the file buffer. It occures in the "construct block" function as far as I can tell. Anyone had this problem before or know how to solve it? I''m stumped. Alex Broadwin A-Tronic Software & Design ----- "if you fail in life, you were destined to fail. If you suceed in life, call me." "The answer is out there." "Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
Advertisement
Pleeeassse.....Help me. This is gonna freeze my development until it is solved. The problem is in a sub-function of malloc. Anyone? Please? I know that nobody likes fighting with memory problems, but this must have come up before. Is this common with fopen?

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
No, it''s not at all common. fopen shouldn''t be crashing on you. I can only imagine that somehow you are corrupting memory elsewhere, because a million and one applications use fopen without any problems. Try calling the memory checking functions (assuming you''re using MSVC) in your main loop to see if your memory is getting corrupted at some point, and then find the problem by narrowing it down to the relevant line of code.
Another possibility is that you do not have write-access to the current directory. This could either be because you''re simply not allowed to write files there, that the disk is full, or that a write-protected file of the same name is in the directory.

-Neophyte

- Death awaits you all with nasty, big, pointy teeth. -

This topic is closed to new replies.

Advertisement