jas@ISI.EDU (Jeff Sullivan) (04/20/91)
I am trying to use a BC++ 2.0 stream. It's an
ifstream tmpin("FILE.IN");
char *tmp1, *tmp2;
The lines of FILE.IN looks like this:
Last Middle First DOB
-------------- --------------- --------------- -------
Smith John Samuel 10/10/77
.
.
.
And what I want to do is read the first line into a char*, so I can
read the second line into a char* and figure out what the field
lengths are. The first gives me the names, the second, the lengths.
Now, I tried this:
tmpin.unsetf(ios::skipws); // To turn off whitespace breaking
tmpin >> tmp1;
I thought this would give me:
" Last Middle First DOB", but it doesn't.
It gives me " Last ". So SKIPWS must still be on, yes? Why?
Also, I want to lose that first space, so I thought I could do this:
tmpin >> ignore (1, '\n') >> tmp2;
And lose the space, slurping the rest into tmp2, but it doesn't let me
do ignore() at all; says I can't use that function on this data type.
Can anyone illuminate me on my problems?
jas
--
--------------------------------------------------------------------------
Jeffrey A. Sullivan | Senior Systems Programmer
jas@venera.isi.edu | Information Sciences Institute
jas@isi.edu | University of Southern California