J
Joe Van Dyk
I have a file that looks like this:
25.000000 55.000000
23.000000 51.000000
5 8
8700 6000
<and then, at byte 128, starts binary stuff>
What's the proper way to make sure that I'm reading in valid data?
Should I check after each cin that the input stream isn't eof?
Also, if the user gives the program an argument on the command-line that
represents a file name, how do I check (without resorting to
platform-specific languages) that the file exists and is readable? Do I
just try reading it?
Thanks,
Joe
25.000000 55.000000
23.000000 51.000000
5 8
8700 6000
<and then, at byte 128, starts binary stuff>
What's the proper way to make sure that I'm reading in valid data?
Should I check after each cin that the input stream isn't eof?
Also, if the user gives the program an argument on the command-line that
represents a file name, how do I check (without resorting to
platform-specific languages) that the file exists and is readable? Do I
just try reading it?
Thanks,
Joe