1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Rep Power

    i'm in hurry please help ! c++ builder file reading

    firs of all i'm sory for my english (i'm still lerning)

    my problem looks like that ...
    i have a file , it's structure looks like that :
    H1 : something
    H2 : something
    H3 : smoething
    for example : i neet to take from the string two first signs and check if it is a "H3" and if it is ....i have to read the rest of line placed behind ":" ...
    how to do it...we have to open the file as a binary ....
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Rep Power
    You could use getline() to read in the first two chars, and then a simple if statement can be used to determine if the variable you read the first two char's into equals "H3". If it does, read the rest of the line, else skip to the next line--you can do that with cin.ignore() or by reading the rest of the line into a dummy variable that you don't use.

IMN logo majestic logo threadwatch logo seochat tools logo