Sign in to follow this  
Jesper T

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

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[i]);
	}
	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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this