Article View: gnu.g++.help
Article #29attach to ifstream
From: Ger Timmens
Date: Wed, 04 Nov 1992 14:43
Date: Wed, 04 Nov 1992 14:43
27 lines
1204 bytes
1204 bytes
I want to attach an ifstream to cin, is this possible with
g++ (version 2.2.2) ?
What I want to do is:
void SomeFunction(string szFileName)
{
ifstream InStream;
if (szFileName == "")
{
InStream.attach(0); // attach InStream to cin
}
else
{
InStream.open(szFileName, ios::in); // attach InStream to szFileName
}
...
}
Thanks in advance,
--
Ger Timmens (ger@cv.ruu.nl) 3DCV Research Group, Utrecht, The Netherlands
Tel.: +31 -30 50 67 11; Room: F.01.7.03; Fax.: +31 -30 51 33 99
.....I'd rather hear Chet miss a note, than Wynton make a thousand......
Chet - Miles - Kenny - Lee - Arturo - Fats - Wynton - Art - Louis - Bix -
Technical Details
Message-ID:
<1992Nov4.144317.12658@cv.ruu.nl>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!swrinde!gatech!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!sun4nl!ruuinf!prisma.cv.ruu.nl!gerShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.help Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!swrinde!gatech!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!sun4nl!ruuinf!prisma.cv.ruu.nl!ger From: ger@cv.ruu.nl (Ger Timmens) Subject: attach to ifstream Sender: usenet@cv.ruu.nl (Usenet Network) Message-ID: <1992Nov4.144317.12658@cv.ruu.nl> Date: Wed, 4 Nov 1992 14:43:17 GMT Nntp-Posting-Host: triton.cv.ruu.nl Organization: University of Utrecht, 3D Computer Vision Research Group Lines: 27