Hello,
I am trying to load up bitmaps onto DirectX surfaces. Well anyway...
this is the function prototype:
Code:
Load_Bitmap_File(BITMAP_FILE_PTR bitmap, char *filename);
so I tried to read the bitmap names from a file with the following:
Code:
infile.open("TileBitmap.dat");
int value = 0;
char tempFilename[256] = {0};
while(infile)
{
infile >> value; //get the bitmap number
infile.getline(tempFilename, 256); //get the filename.bmp
MessageBox(main_window_handle, tempFilename, "Test", MB_OK);
if (!(Load_Bitmap_File(&bit, tempFilename)))
{
infile.close(); //close the file
return 0; //and report error
}
LoadBitmapSurface(Tiles[value], surface_desc, bit, TILE_WIDTH, TILE_HEIGHT); //if all good, load it into surface array
}
infile.close(); and the darn thing fails with the Load_Bitmap_File
notice the MessageBox function, it outputs the contents of tempFilename. It displays filename.bmp. So it got the name, but it won't load the bitmap.
So I tried... manual initialization
Code:
char tempFilename[256] = "filename.bmp"
Load_Bitmap_File(&bit, tempFilename);
and that works fine! So what could be the problem here? is it somethhing with the cin.getline?? I checked the length, and it was correct...
-Pizzaman