printf

This topic is 4203 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

ok for some reason i can't get printf to work correctly. im trying to display an error message if my font doesn't load in SDL_TTF i know the font isn't loading because of a previous error, which happened when i tried to close the font. (it never opened so it couldn't close it) im using <stdio> as i should be that much i know, but where should the text print out to, and what is a correct format for printing the error message?(SDL_GetError, i believe it is)

Share on other sites
The printf function is intended for only the most basic text output to a console window. It WILL NOT WORK in a windows application window, etc. As for the error message, I really cant help seeing as I do not use SDL.

[EDIT] Also, while i'm posting I might as well mention that it took me about 10 attempts to post this message. Something tells me that gamedev is outgrowing whatever bandwidth limitations it might have.

Share on other sites
SDL_GetError() returns a char* which is used like so:
printf("Error: %s", SDL_GetError());

This will appear in a file called stdout.txt in your .exe directory because SDL does some funky redirecting.

Share on other sites
ok cool thanks
i'll make sure i check the file
there are 2 files created in the folder and when i last checked them they were empty...maybe i did something wrong.

im at work and can't check the files right now, but if i need more help i will be back on here

Share on other sites
Quote:
 Original post by scourgezok cool thanksi'll make sure i check the filethere are 2 files created in the folder and when i last checked them they were empty...maybe i did something wrong. im at work and can't check the files right now, but if i need more help i will be back on here

One is stderr.txt and the other stdout.txt. If you cought an error yourself and appropriatly quit you will see your message in stdout.txt. If you misused something you will see SDL telling you a segfault happened in stderr.txt.

Share on other sites
appropriatelty wuit huh? :P

the compiler comes up unhalndled exception, line so and so, and it shows me the TTF_Close() line. i'll run it and check the txt files when i get home.
thank for all the help :)

Share on other sites

This topic is 4203 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Create an account

Register a new account

• Forum Statistics

• Total Topics
628764
• Total Posts
2984563

• 13
• 9
• 25
• 12
• 9