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?
ubuntu SDL not outputting stdout.txt/stderr.txt or showing terminal window
Started by sega16, Oct 11 2012 04:06 PM
2 replies to this topic
Ad:
#2 Members - Reputation: 138
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:
... 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.
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.






