Author Topic: Input / output redirection before run  (Read 12260 times)


  • Guest
Input / output redirection before run
« on: December 18, 2010, 09:44:58 am »
Hi, I'm not a professional programmer and I use CB to run Fortran code. Can someone suggest how to make input / output redirection in CB? More specifically I would like to read from a file instead than type input. From the console, this can be done with the console comand: program_name.exe< inputfilename. It should be possible to redirect input running the program by CB but I'm cannot find this possibility in the settings. Thanks in advance for your help.

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: Input / output redirection before run
« Reply #1 on: December 18, 2010, 01:43:47 pm »
Project -- Set program's argument -- Select your target -- Program arguments


  • Guest
Re: Input / output redirection before run
« Reply #2 on: April 29, 2013, 05:56:01 pm »
I want to do something similar i.e redirect the contents of a file to the program so that rather than reading from stdin the program reads from the redirected input. Equivalent to pgm.exe < input

Is it possible to do this in code blocks ??

If  <input.txt is entered in the 'Program Arguments window:' it appears as a string in the char*argv[] parameter of main(..) function.

Thanks in advance.