Code::Blocks Forums
User forums => Help => Topic started by: visir on December 24, 2017, 08:39:53 pm
-
I just tried adding >stdout.txt to the Project->Set Program Arguments.
Didn't work. Program receives it as an argument, and no redirection happens.
-
Hm, don't do that on windows. It corrupted binary data, probably because it treated it as text.
Remade it as fopen("bw+"), it works now.
Figured it out from the fact that pcm_u16le sounded less noisy than pcm_s16le. Ascii text only takes first 128 possible values of a byte. I'm not sure if I'm lucky or the opposite. Holy shit. How the f*ck I made this connection.
-
Hm, don't do that on windows. It corrupted binary data, probably because it treated it as text.
Remade it as fopen("bw+"), it works now.
Figured it out from the fact that pcm_u16le sounded less noisy than pcm_s16le. Ascii text only takes first 128 possible values of a byte. I'm not sure if I'm lucky or the opposite. Holy shit. How the f*ck I made this connection.
what are you talking about?
I just tried adding >stdout.txt to the Project->Set Program Arguments.
Didn't work. Program receives it as an argument, and no redirection happens.
This obviously does not work. Your program needs a console host to run in it and the stream operator is a command of this console host, not for your program or windows. And also codeblocks does not know how to interpret the stream operator, because it is not a console host.
-
So I can't run programs that use stdin or stdout?
>what are you talking about?
Just one bug I had a problem with for a few days. Binary data was corrupted after passing stdout, but text worked fine.
-
So I can't run programs that use stdin or stdout?
You can not use the CB run and use stdin or stdout.
I hope you know enough to run programs that use stdin or stdout?
If not, I suggest learning how to open an command prompt to run your program.
Edit: Once, you figure out how to use the "command prompt"; I would suggest loking at the CB tools menu or toolsplus plugin.
Tim S.
-
I just tried adding >stdout.txt to the Project->Set Program Arguments.
Didn't work. Program receives it as an argument, and no redirection happens.
It's called "Set program arguments", because you set program arguments.
A redirection is something different and has nothing to do with arguments, even if on a shell (console/cmd) it looks similar.
-
So debugging programs like that is impossible...?
-
Yep, unfortunately.
-
You can run every project in a console and copy and paste the content to review it.
Just check "Project -> Set programs' arguments... -> Run host in terminal".