Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualakesterson

Posted 14 October 2012 - 08:03 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.

#1akesterson

Posted 14 October 2012 - 08:02 AM

On posix systems, SDL does not create stdout.txt and stderr.txt; those are purely MinGW SDL conventions from Windows. 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.

PARTNERS