#### Archived

This topic is now archived and is closed to further replies.

# New problem...

## Recommended Posts

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!"

##### Share on other sites
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?

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."

##### Share on other sites
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.

##### Share on other sites
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. -

• ### Forum Statistics

• Total Topics
628329
• Total Posts
2982105

• 22
• 9
• 9
• 13
• 11