Author Topic: [don't care]Program arguments, redirect output, >stdout.txt  (Read 651 times)

Offline visir

  • Multiple posting newcomer
  • *
  • Posts: 76
[don't care]Program arguments, redirect output, >stdout.txt
« 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.
« Last Edit: December 25, 2017, 06:05:57 am by visir »

Offline visir

  • Multiple posting newcomer
  • *
  • Posts: 76
Re: Program arguments, redirect output, >stdout.txt
« Reply #1 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.

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1879
Re: [don't care]Program arguments, redirect output, >stdout.txt
« Reply #2 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.

Offline visir

  • Multiple posting newcomer
  • *
  • Posts: 76
Re: [don't care]Program arguments, redirect output, >stdout.txt
« Reply #3 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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6252
    • My Best Post
Re: [don't care]Program arguments, redirect output, >stdout.txt
« Reply #4 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.
 
« Last Edit: December 25, 2017, 08:16:08 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7259
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: [don't care]Program arguments, redirect output, >stdout.txt
« Reply #5 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.

Offline visir

  • Multiple posting newcomer
  • *
  • Posts: 76
Re: [don't care]Program arguments, redirect output, >stdout.txt
« Reply #6 on: December 26, 2017, 02:05:37 pm »
So debugging programs like that is impossible...?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10904
    • Travis build status
Re: [don't care]Program arguments, redirect output, >stdout.txt
« Reply #7 on: December 26, 2017, 03:09:07 pm »
Yep, unfortunately.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7259
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: [don't care]Program arguments, redirect output, >stdout.txt
« Reply #8 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".