hi guys so i have to read a file the file is formatted as:
0101010101010101 ; this line is blah blah
0101010101010101 ; 2nd line
and so forth,so what i wana do is read in the 0's and 1's and ignore everything after the " ; " including the " ; " (semi-colon).
im reading the numbers into bitsets.
i also want to include the possibility that after the semi-colon there couldn't be a line description, that is semi-colons are constant in all of the lines but line comments may or may not be present.
i can read in the 0's and 1's just fine without ";" and line comments, so i guess what i really am asking is how do i ignore the ; and line comments , remember line comments may not be present in all lines
so guys how do i implement that?? thanks so much for ur time!
Your sample data shows a space between the digits and the semicolon, if the space is always present, you could just use the normal >> extraction operator to get the binary digits as a string, then use ignore() to ignore the remainder of each line.
Or maybe use getline with a semicolon as the delimiter like this: