Code::Blocks Forums

User forums => Help => Topic started by: visir on December 24, 2017, 08:39:53 pm

Title: [don't care]Program arguments, redirect output, >stdout.txt
Post 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.
Title: Re: Program arguments, redirect output, >stdout.txt
Post by: visir on December 25, 2017, 06:05:27 am
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.
Title: Re: [don't care]Program arguments, redirect output, >stdout.txt
Post by: BlueHazzard on December 25, 2017, 11:56:40 am
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.
Title: Re: [don't care]Program arguments, redirect output, >stdout.txt
Post by: visir on December 25, 2017, 07:13:52 pm
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.
Title: Re: [don't care]Program arguments, redirect output, >stdout.txt
Post by: stahta01 on December 25, 2017, 08:01:46 pm
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.
 
Title: Re: [don't care]Program arguments, redirect output, >stdout.txt
Post by: Jenna on December 26, 2017, 12:34:43 am
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.
Title: Re: [don't care]Program arguments, redirect output, >stdout.txt
Post by: visir on December 26, 2017, 02:05:37 pm
So debugging programs like that is impossible...?
Title: Re: [don't care]Program arguments, redirect output, >stdout.txt
Post by: oBFusCATed on December 26, 2017, 03:09:07 pm
Yep, unfortunately.
Title: Re: [don't care]Program arguments, redirect output, >stdout.txt
Post by: Jenna on December 27, 2017, 10:50:44 am
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".