C++ iostreams, reassigning
Posted: Sun Jul 13, 2003 3:38 pm
I would like to know how to reassign standard input/output streams in C++. I'm somewhat new to C++
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]

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]