- Online Community Forums » Programming Questions » [A5] al_save_bitmap can't pass a variable for the filename?

This thread is locked; no one can reply to it. rss feed Print
[A5] al_save_bitmap can't pass a variable for the filename?
Member #15,203
June 2013

I'm trying to save a bitmap using a name specified elsewhere in the program using a variable. I've tried a bunch of different ways but maybe I'm missing something here?

"fileName" is a const char* in the (relevant) code below:

1ALLEGRO_BITMAP *newSheet = CreateBlankSheet(gridColor, backColor, cellWidth, cellHeight, gridRows, gridColumns, true); 2if (al_save_bitmap(fileName, newSheet)) 3{ 4 soundBank.PlayInstance("Done"); 5 LoadEntries(); 6 cursorPos = entries[0].inputPosition.x; 7 currentItemSelection = 0; 8 maxItemSelection = entries.size(); 9}

Maybe I just need more sleep...

Member #7,827
October 2006

Do you get some error? Does the fileName have an extension and if so what is it?

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Member #15,203
June 2013

Yeah, it just returns false... the filename comes from the following:

fileName = al_cstr(entries[i].value);

Where entries[i].value is an ALLEGRO_USTR

The filename example value is "test.png"


I see it now... it was "TEST.PNG" and I suppose the function only can determine file type with a lowercase name... odd!

Thanks for letting me think out loud man... appreciate your time.

Go to: