Jump to content
  • Advertisement
Sign in to follow this  
Jesper T

"Debug assertion failed" (MSVC++.NET)

This topic is 5195 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

I have a problem with my program. When I run it in debug mode I get a message:
Quote:
Debug Assertion Failed Program: c:\path\myProg.exe File: fopen.c (this is not a file in my project) Line: 55 Expression: *file != _T('\0')
I can just select "ignore" and the program will run fine, but still, it must mean that there is something wrong. Ive traced the problem to a call to "is_open()" in a loop here:
for(int i = 0; i < MAX_MENU_TEX; i++)
{
	char tpa[MAX_PATH];
	loaf.getline(tpa, MAX_PATH, '\n');

	ifstream testf(tpa, ios::in);
	
	if(testf.is_open())
	{
		testf.close();
		loadTexture(tpa, &menuTex);
	}
	else
	{
		if(i < 1)
			return false;

		return true;
	}
}

If i replace "testf.is_open()" with "1" the message doesnt appear. So what might be the problem here? Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Expression: *file != _T('\0')

That means that the filename you're passing to the function is an empty string (""). So the string you're reading is a blank line.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Expression: *file != _T('\0')

That means that the filename you're passing to the function is an empty string (""). So the string you're reading is a blank line.


Allright, but when I pass that same path to loadTexture() the texture loads just fine. That should not be possible if the path is an empty string should it?

Edit:

Oh wait, I get it now. Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

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