Author Topic: Redirecting standard input  (Read 8046 times)

Offline candide

  • Single posting newcomer
  • *
  • Posts: 8
Redirecting standard input
« on: February 05, 2009, 12:36:21 am »
Hi all

I try to redirect standard input from a text file to an executable program generated with codeblocks. With C::B running under Linux Ubuntu, from the menu Projet > set program's arguments, setting the program argument's box to

< foo.txt

does redirect the standard input to the foo.txt text file.

But this doesn't work under Windows. Another way to do this ?



Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Redirecting standard input
« Reply #1 on: February 05, 2009, 06:38:00 am »
Under windows, You should use:

XXX.exe >> a.txt


Which redirect the standard output to a.txt
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline candide

  • Single posting newcomer
  • *
  • Posts: 8
Re: Redirecting standard input
« Reply #2 on: February 05, 2009, 01:27:25 pm »
Under windows, You should use:

XXX.exe >> a.txt


Which redirect the standard output to a.txt
The question was on redirecting
  • standard INPUT (and not output)
  • from inside codeblocks and not  from the command line.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Redirecting standard input
« Reply #3 on: February 05, 2009, 01:34:46 pm »
Sorry for my mistake :D.
But I haven't heard direct INPUT in windows....
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Redirecting standard input
« Reply #4 on: February 05, 2009, 01:58:26 pm »
Not related to C::B and therefore violating our forum rules.

Topic locked.