Jump to content

need help cannot read.

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
StraxorX

StraxorX

    Newbie

  • Members
  • Pip
  • 1 posts
I having problem reading from text files after i write to text files.


the text file
Booking.txt
Booking ID * Customer ID Flight ID Seat IDs
4001| 1001| 9002| A1,A2,A3,A4,

I can't read the last line "A1,A2,A3,A4,"
i want to make sure that it read only A1 then A2 and follow on..instead of reading A1,A2,A3,A4, in one variable.

can anyone help me?

here my coding.

sorry for my poor english.

Attached Files



#2
Lance

Lance

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 276 posts
std::istream::getline has a overloaded form which allows you to specify a delimiter. You may solve your current problem with this.

char buff[1024];

std::cin.getline(buff, 1023, ',');

Or you can read the whole line and parse the comma separated list of string by yourself.