1

I Wanna Save The Output Of The C Compiler Named tcc. Tryed Using Redirections In Windows 7 Command Prompt But It Generates An Empty File And Writes The Output In The Command Prompt.

This Is What I Use In Command Prompt:

tcc -o test.exe test.c > log.txt
hmak.me
  • 3,770
  • 1
  • 20
  • 33
  • 2
    Try `tcc -o test.exe test.c 2> log.txt` (should redirect `stderr` instead of `stdout` to the logfile. But I'm not sure about this on windows. – Jost Mar 01 '15 at 11:24
  • Tanks A Lot. Please Write Post It As Answer So I Can Accept It. Can You Please Give Me A Resource To Learn More About The Number Before >? – hmak.me Mar 01 '15 at 11:27

1 Answers1

3

There are multiple output streams a program can write to, in particular there are the default streams stdout and stderr. Other streams can be files, network connections and much more.

The standard stream stderr is usually used to output error messages and debug info, stdout is usually used to output the result of a program. What exactly is written to each stream depends on the program.

The stdout stream has identifier 1, stdout has identifier 2. The number in front of the > identifies which stream to redirect. If there is no number given, 1> is assumed.

You can read more about this here, it should give you some keywords to search.

Jost
  • 5,948
  • 8
  • 42
  • 72