|
how to use fprintf in ALLEGRO_FILE? |
vkensou
Member #15,546
March 2014
|
i did not find some methods like al_fprintf(). and how to use fprintf? |
Arthur Kalliokoski
Second in Command
February 2005
|
vkensou said: how to use fprintf I assume you already know how to use printf. You simply add the stream as the first parameter to fprintf(). If you said printf("Hello, world!\n"); it'd be the same as fprintf(stdout,"Hello, world!\n"); but you can substitute some text file pointer for stdout, or stderr so redirection won't hide errors printed to console etc. They all watch too much MSNBC... they get ideas. |
LennyLen
Member #5,313
December 2004
|
Arthur Kalliokoski said: You simply add the stream as the first parameter to fprintf(). fprintf() expects a FILE, not an ALLEGRO_FILE. It might work anyway, but I wouldn't rely on it. You can use snprintf() to create a formatted string, and then use al_puts() to write it to the file.
|
Thomas Fjellstrom
Member #476
June 2000
|
Hm, that might be a bit of an oversight. Might want to add a al_fprintf and similar to the api -- |
beoran
Member #12,636
March 2011
|
Yes, that would be useful and nice to have, so I added it to the roadmap on the wiki. This is really not that hard to implement, so if anyone feels they want to do this, please do so and post your patch here or on the mailing list. |
Elias
Member #358
May 2000
|
u = al_ustr_newf(fmt, "%s", "blah"); al_fputs(f, al_cstr(u)); al_ustr_free(u);
-- |
|