Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


ubuntu SDL not outputting stdout.txt/stderr.txt or showing terminal window


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 sega16   Members   -  Reputation: 131

Like
0Likes
Like

Posted 11 October 2012 - 04:06 PM

I am using sdl with code::blocks I did not use the sdl preset because it creates a c++ project and I want a C program also the preset appears to have the same issue of not saving stdout.txt so I created a blank project and set up sdl in the project and I have tried both GUI application and console application and non of those target options seem to affect anything how do I either get a consol output or stdout.txt non of those are appearing. I am new to ubuntu gnu/linux so is it ubuntu or my program?

Sponsor:

#2 akesterson   Members   -  Reputation: 150

Like
4Likes
Like

Posted 14 October 2012 - 08:02 AM

On posix systems, SDL does not create stdout.txt and stderr.txt; those are purely Windows conventions. On posix systems (e.g. ubuntu), if you run your program directly from the terminal, you will see output in the terminal, instead of in those files.

For example:

akesterson@localhost:~$ cat printer.c
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
		fprintf(stdout, "This is output.\n");
		fprintf(stderr, "This is an error.\n");
		return 0;
}
akesterson@localhost:~$ gcc -o printer printer.c
akesterson@localhost:~$ ./printer
This is output.
This is an error.
akesterson@localhost:~$ ./printer > stdout.txt
This is an error.
akesterson@localhost:~$ ./printer > stdout.txt 2>stderr.txt
akesterson@localhost:~$ cat stdout.txt
This is output.
akesterson@localhost:~$ cat stderr.txt
This is an error.

... If you want stdout.txt and stderr.txt, you'll have to manually redirect them. POSIX default behavior is that both output streams go to the terminal running the program. If you're not seeing this behavior, it's likely a result of the IDE you're using, and how it's launching/consuming the output. If you go to the directory with the compiled binary, and run it by hand, you should see the expected output in your terminal.

Edited by akesterson, 14 October 2012 - 08:03 AM.


#3 sega16   Members   -  Reputation: 131

Like
0Likes
Like

Posted 17 October 2012 - 05:22 PM

Ok thank you I ran my program in terminal and now I am seing the output.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS