C++ iostreams, reassigning

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
tp
New poster
Posts: 4
Joined: Sun Feb 03, 2002 2:00 am

C++ iostreams, reassigning

Post by tp »

I would like to know how to reassign standard input/output streams in C++. I'm somewhat new to C++ :roll:

To be exact, i need C++ equivalent (using iostreams) to following C code, which i've been using when submitting programs:

[c]
const char *infile = "101.in", *outfile = "101.out";
char *ibuf = NULL, *obuf = NULL;

int main(void)
{
#ifndef ONLINE_JUDGE
freopen(infile, "rt", stdin);
freopen(outfile, "wt", stdout);
#endif
setvbuf(stdin, ibuf, _IOFBF, 8192);
setvbuf(stdout, obuf, _IOFBF, 8192);
}[/c]
Post Reply

Return to “C++”