bagchi@sparky.eecs.umich.edu (Ranjan Bagchi) (06/06/90)
I need to access the character data which would normally be put to
an ostream, for further use in my program.
Is there any way (ideally) to declare a character buffer, foo, to be an
ostream, so that foo << bar, with bar being some kind of object class,
would leave me with everything that would ordinarily go to the
standard output/file in the foo buffer?
If not, is there some kind of kludgy workaround that works under
g++?
-rj
bagchi@eecs.umich.eduttsung@larry.lerc.nasa.gov (Amy Sung) (07/26/90)
I was following an example of reference types and found myself lost. In the
example given in the PROGRAMMING IN C++ by S. Dewhurst & K Stark on section
3.1, the scenario was like this:
______________________________ example __________________________
1. int size= 0;
2.
3. main() {
4. input( list, max, size );
5. output( list, size );
6. }
7.
8. void
---->> 9. input( String *a, int limit, int &i ) {
a. for( i=0; i<limit; i++ ) {
b. scanf( "%s", buffer ); ....
c. a[i]= String( buffer );
d. }
e. }
It's line #9 that causes problems. My Cfront compiler wouldn't let go that
line and kept complaining it's a syntax error. I would like to know if it
is an illegal syntax or it's a compiler fraud? Can someone please straighten
this one out for me. Thanks in advance.
\amy
'
--
~~~~~~~ The only good is knowledge; and the only evil is ignorance ~~~~~~~~
Amy H. Sung email: ttsung@csduts1.lerc.nasa.gov
2001 Areospace Parkway, MS. SVR-1143 phone: 216 891-2922
Brook Park, OH 44142