Profiling error

Started by
2 comments, last by Atm97fin 20 years, 4 months ago
When I try to profile my program I get Invalid handle error from windows ReadFile function. Creating the file succeeds. I try to open the file from my bitmap handling object. Excluding the object won't help. Here's the code:

        int red = 0;
        HANLDE file = NULL;
	file = CreateFile(filename,FILE_ALL_ACCESS,0,NULL,OPEN_EXISTING,
		FILE_ATTRIBUTE_NORMAL,		NULL);

	if (file == NULL)
	{
		ErrorBox(NULL,"cant create file");
		return FAILURE;
	}
	
	ReadFile(file,&bmfh,sizeof(BITMAPFILEHEADER),&red,NULL);
	if (bmfh.bfType != 19778)	// not a bitmap

	{	
                ShowError();
		ErrorBox(NULL,"not a bitmap");
		CloseHandle(file);
		return FAILURE;
	}
Should I change the CreateFile parameters or what? [edited by - Atm97fin on December 14, 2003 10:30:51 AM] [edited by - Atm97fin on December 14, 2003 10:31:58 AM]
EasyGL - easy to use graphics library.
Advertisement
Yes - it looks that way: CreateFile
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
It seems that the CreateFile function doesn''t accept my filenames. Ex: "directory\\file.bmp"

What could be the reason for this. They work fine when i''m not profiling.
EasyGL - easy to use graphics library.
Possibly the profiler causes it to run from a different path? ie if you''ve got relative paths to your resources they might not be valid

This topic is closed to new replies.

Advertisement