Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!uunet!munnari.oz.au!metro!seagoon.newcastle.edu.au!kevin From: kevin@iti.org (Kevin Wallace) Newsgroups: comp.lang.c++ Subject: AT&T's strstreams in g++ ?? Message-ID: Date: 25 Apr 91 06:05:12 GMT Sender: news@neddy.newcastle.edu.au Distribution: comp Organization: Uni of Newcastle, Australia Lines: 36 I am "porting" code developed using AT&T C++ Release 2.1 to G++ v1.37. My problem is this: How do you associate a string with the input stream in g++ - ie. read from a string with operator >> instead of from cin ? Below is a cutdown excerpt of what I'm doing in AT&T C++ that I'd like to imitate in g++. // The program: // ---------------------------------------------------------------------------- #include #include #include int main() { char buf[256]; char word[16]; strcpy(buf,"Hello world"); istrstream ss(buf); ss >> word; cout << word << "\n"; ss >> word; cout << word << "\n"; } // ---------------------------------------------------------------------------- // Run output: // ---------------------------------------------------------------------------- Hello world // ---------------------------------------------------------------------------- Kevin (kevin@pleiades.newcastle.edu.au)