Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: sd3969682 on January 15, 2012, 09:35:22 am

Title: Unable to set redirection in windows
Post by: sd3969682 on January 15, 2012, 09:35:22 am
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? :-[
Title: Re: Unable to set redirection in windows
Post by: zabzonk on January 15, 2012, 08:24:17 pm
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.
Title: Re: Unable to set redirection in windows
Post by: 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.
Title: Re: Unable to set redirection in windows
Post by: MortenMacFly on January 15, 2012, 10:01:01 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.
Title: Re: Unable to set redirection in windows
Post by: sd3969682 on January 15, 2012, 10:24:23 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!
Title: Re: Unable to set redirection in windows
Post by: Alpha on January 15, 2012, 11:13:39 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 (http://wiki.codeblocks.org/index.php?title=Tools%2B_reference).