News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Unable to set redirection in windows

Started by sd3969682, January 15, 2012, 09:35:22 AM

Previous topic - Next topic

sd3969682

I have a really annoying problem.
When I using codeblock in windows and setting the program's arguments such as:
-someCommand <input.txt >output.txt
The redirecting just doesn't work!
It still ask me to input from my screen(keyboard), but not from the file.
However, it does work in DOS or even codeblock in ubuntu.
I intend to programming in windows. Thus, anyone who can help? :-[

zabzonk

That's because they are the program's arguments, not the shell's. In other words, the redirection characters are simply passed to the program as part of the argc/argv parameters. I'm surprised it works on Ubuntu though.

Alpha

A workaround would be to to have Code::Blocks execute your command in a post-build step or a commands only target, or if that does not work, write a batch file with your command in it, and have Code::Blocks execute the batch file.

MortenMacFly

Quote from: Alpha on January 15, 2012, 08:40:42 PM
A workaround would be to to have Code::Blocks execute your command in a post-build step or a commands only target, or if that does not work, write a batch file with your command in it, and have Code::Blocks execute the batch file.
Even easier: Make use of the toll.s menu and it's associated macros.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

sd3969682

Quote from: MortenMacFly on January 15, 2012, 10:01:01 PM
Quote from: Alpha on January 15, 2012, 08:40:42 PM
A workaround would be to to have Code::Blocks execute your command in a post-build step or a commands only target, or if that does not work, write a batch file with your command in it, and have Code::Blocks execute the batch file.
Even easier: Make use of the toll.s menu and it's associated macros.
Oh! I found that. But I'm new with that and don't know what to do.
Can you give me a simple example? Thanks a lot!

Also thanks Neil and alpha!

Alpha

Quote from: sd3969682 on January 15, 2012, 10:24:23 PM
Quote from: MortenMacFly on January 15, 2012, 10:01:01 PM
Even easier: Make use of the toll.s menu and it's associated macros.
Oh! I found that. But I'm new with that and don't know what to do.
Can you give me a simple example? Thanks a lot!
Try the Tools+ reference.