Sign in to follow this  

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by scourgez
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


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 this post


Link to post
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 this post


Link to post
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.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this