Jump to content
  • Advertisement


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


fopen working then failing?

This topic is 5719 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay Ive been working on a tile system and its now time to make an editor, Ive got this logger which logs errors, now its never failed before but now for some reason while using MFC it is doing wierd stuff, i was wondering if anyone could tell me that it could be a clash in the mfc code and mine? or its just a wierd error?, anyways heres the code

// Prints a formatted message to the file


void CLog::Print(char *text, ...)
	char buffer[256];
	//clear buffer


	// Combine args with the string

	va_list args;
	va_start(args, text);
	vsprintf(buffer, text, args);

	m_File = fopen(m_Filename,"a+");



Okay, Now ive stepped though it in the debugger several times, the first call to that function succeeds and the second doesnt. fopen fails on the second call. m_Filename never changes, and buffer is of a valid length < 256, ive also tried a and a+ for the file open settings. Heh anyone?

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
I had a similar problem with a school project some time ago, I had to look in the config.sys file and see how many files and buffers I had available, turns out I only increased the file''s number and it stop having problems, maybe you could try it...

Share this post

Link to post
Share on other sites
Original post by ACAC
xp doesnt have a config.sys does it? heh

No, but it does have environment variables and the like, which is effectively the same.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!