Yes, that is most likely the case, because the file is setup as... 0 grass1.bmp 1 grass2.bmp 2 grass3.bmp . . . -Pizzaman -It's like blowing up an abortion center because you are pro life.
Pizzaman
Posts
-
Why won't this simple thing work? -
Career in C/C++/VC++Hey, I am currently a student, senior year college. This summer I picked up Petzold Windows Programming and started going into it. I do it because I am interested and would like to pursue in the Windows direction; however I know I still have much more to learn about the theory and databases and things like that.. that actually makes a program run. I have the fear of time running out too soon. -Pizzaman -It's like blowing up an abortion center because you are pro life.
-
Why won't this simple thing work?Hello, I am trying to load up bitmaps onto DirectX surfaces. Well anyway... this is the function prototype:
Load_Bitmap_File(BITMAP_FILE_PTR bitmap, char *filename);
so I tried to read the bitmap names from a file with the following: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 initializationchar 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... Please help thanks! -Pizzaman -It's like blowing up an abortion center because you are pro life. -
A sad dayYa but sometimes losing data on computers could be worth a lot more than your lava lamp collection. -Pizzaman It's like blowing up an abortion center because you are pro life.