jas@ISI.EDU (Jeff Sullivan) (04/18/91)
I'm just getting into Borland C++ and I'd like to use the Streams package they supply. Unfortunately, I've got to leap into this and try to get something big ported from perl right away, so I don't have the luxury of a lot of time to mosey through the manuals. I have an input file that looks like this: HEADER FIELD FIELD2 FIELD3 ... FIELDN -------------- --------------- ------- ------------- DATA1 DATA2 DATA3 DATAN And I don't know a priori how many fields there will be. I can use the ---- line as a format specifier, but to do this, I'd like to chop off that leading space. I tried this after opening the file as a ifstream called tmpin: char *tmpLine; tmpin.resetiosflags(ios::skipws); // I want to preserve WS tmpin >> ignore(1, '\n') >> tmpLine; I get the following errors: 1. 'resetiosflags' is not a member of 'ifstream' (I Know, but it's a stream manipulator, shouldn't it be accessible?) 2. Function 'ignore' should have a prototype in function 'main' (but ignore is defined as a member function of istream -- why isn't it being recognized as such?) Does anyone have any example code that does something real in Borland C++ with streams? jas -- -------------------------------------------------------------------------- Jeffrey A. Sullivan | Senior Systems Programmer jas@venera.isi.edu | Information Sciences Institute jas@isi.edu | University of Southern California
metz@donald.iam.unibe.ch (Igor Metz) (04/19/91)
This is a little hack which will produce acceptable results. Only problem:
class declarations do not look very nice ...
It's based on a hack for cb posted by gaa@castle.ed.ac.uk this week
#!/bin/sh
sed -e 's/::/_XX_/g' \
-e 's/\/\/\(.*\)$/\/*_#\1#_*\//g' |\
indent -st -i2 -ncdb -nfc1 -l999 | \
sed -e 's/_XX_/::/g' \
-e 's/\/\*_#\(.*\)#_\*\/$/\/\/\1/g'\
-e 's/\/\* _#\(.*\)#_ \*\/$/\/\/\1/g'
--
Igor Metz
Institut fuer Informatik und angew. Mathematik, Universitaet Bern, Switzerland.
domainNet: metz@iam.unibe.ch Phone: (0041) 31 65 49 90
ARPA: metz%iam.unibe.ch@relay.cs.net Fax: (0041) 31 65 39 65