Sunday, October 25, 2009

Taking input and ouput from a file

Dont misinterpret the heading. I mean when it is large input and output it takes a lot of time for debugging. So when in a contests this is quite a helpful thing.

For taking input from a file...

In linux,
$./a.out < in_filename

In windows(working on Cygwin or MingW),

$a.exe < i.in

Similarly for storing output into a file...

In Linux,
$./a.out < out_filename

In widnows,

$a.exe < out_filename

the file can have any extension as such .txt,.c,.cpp... etc reads like a binary file i suppose(txt always works). It assumes this file that you provide as the Console...so enjoy saving time on debugging programs that have large inputs.

No comments:

Post a Comment