Well, I have no clue about how Code::Block works, in Visual Studio you can
use the "command arguments". Passing (without the quotes) "< test.in >
file.out" as argument achieves the same effect. Maybe the same can be done
in Code::Block.

I do it inside the code actually, in C/C++ you can call freopen to redirect
input and output, and in Java you can call System's setIn and setOut
methods. And then use normal standard input/output methods, to achieve the
same effect as previous examples you'd do:

C/C++:
freopen("test.in", "r", stdin);
freopen("file.out", "w", stdout);

Java:
System.setIn(new FileInputStream("test.in"));
System.setOut(new PrintStream("file.out"));

I guess other languages have means to do the same, but I'm not familiar with
them.
Carlos Guía


On Sat, Apr 16, 2011 at 11:00 PM, Mohammad Hoda <shiyamh...@gmail.com>wrote:

> Hi Carlos
> How to do that while using some IDE like say Code::Block
> thanks
>
> On Apr 13, 2:37 am, Carlos Guia <zyx3d...@gmail.com> wrote:
> > You can do that, but remember you have 4 (8 for large) minutes from the
> > moment you start downloading to the moment submit both output and source.
> > However, if your code works like that, from standard input to standard
> > output, you can simply redirect files instead doing it manually. Let's
> say
> > you program is called "program" :), and have downloaded an input file
> called
> > test.in you can generate file.out like this in the terminal:
> >
> > program < test.in > file.out
> >
> > This works in both Linux and Windows, and have never tried, but I assume
> it
> > works on Mac too.
> >
> > Carlos Guía
> >
> >
> >
> >
> >
> >
> >
> > On Tue, Apr 12, 2011 at 9:19 AM, Chaitu <chaituch...@gmail.com> wrote:
> > > Hi,
> > > I am new to this contest and this is my first time in a programming
> > > competition. I would like to know whether the input file has to take
> > > directly in the code or can we input the values in the terminal if we
> > > want and get the output on the terminal and save it in a file?
> > > Bye,
> > > chaitu
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "google-codejam" group.
> > > To post to this group, send email to google-code@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > google-code+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-code?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-codejam" group.
> To post to this group, send email to google-code@googlegroups.com.
> To unsubscribe from this group, send email to
> google-code+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to