hello everyone,

i am trying to read a unformatted text file using ifstream.
i want to read the lines..i have done by using getline.
but my text file format looks like

firstname:abd lastname:cbd
user name is abd cbd
age is 45
height is 66cms

I was able to read line 1 and line 2 by taking there first word,,but having problem wid taking line 3 and line 4 first words..

How to i skip spaces before age and height??
please help me
Thanks in advance.

not sure what you mean.
cin<< should ignore spaces.
or you can call a space taker function which would look something like this
input_file.peek(c);

while (c!=' ')
{
   input_file.get(c);
   input_file.peek(c);
}

that way it gets all the spaces away.
hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.