Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Custom save names

This thread is locked; no one can reply to it. rss feed Print
Custom save names
inspiredevistate
Member #7,980
November 2006

Okay maybe I am just having a general brainfart here, but how do I allow the user to specify the name of the file s/he wants to save? I am reading the typed name into the buffer using readykey(). I am also using save_bitmap(filenamehere, eg, eg);

Thanks in adavance:)

LennyLen
Member #5,313
December 2004
avatar

If you've read the user input to a buffer called save_name, then:

save_bitmap(save_name, bmp, pal)

inspiredevistate
Member #7,980
November 2006

for example i've read into the buffer... called buffer

the user types "myfile"

then all I do is use save_bitmap(buffer, bmp, pal);

LennyLen
Member #5,313
December 2004
avatar

Quote:

then all I do is use save_bitmap(buffer, bmp, pal);

Yes. I'm also assuming that as you're adding the input to the buffer that you're checking for characters that aren't allowed in filenames (Windows doen't allow /\:*?"<>|, and I dont know about other OSes).

inspiredevistate
Member #7,980
November 2006

awesome, thank you!! :P

TeamTerradactyl
Member #7,733
September 2006
avatar

You can also use the standard Allegro file_select_ex which does the whole "keyboard input" thing for you...

Go to: