P
PengYu.UT
Hi,
Suppose I a file with the following format --- each line is either a
record or a blank line.
If it is a record, it might be of one of the following format, where
the first format means t equals 1 by default.
w h
w h t
It is very simple to read this file if it only have "w h" record or "w
h t" record. Like the following tow code segments:
ifstream in_file;
int w, h
while(in_file >> w >> h){
....
}
ifstream in_file;
int w, h, t
while(in_file >> w >> h >> t){
....
}
But it is not very straight forward to me how to read a file with both
kinds of records. Would you please help me?
Best wishes,
Peng
Suppose I a file with the following format --- each line is either a
record or a blank line.
If it is a record, it might be of one of the following format, where
the first format means t equals 1 by default.
w h
w h t
It is very simple to read this file if it only have "w h" record or "w
h t" record. Like the following tow code segments:
ifstream in_file;
int w, h
while(in_file >> w >> h){
....
}
ifstream in_file;
int w, h, t
while(in_file >> w >> h >> t){
....
}
But it is not very straight forward to me how to read a file with both
kinds of records. Would you please help me?
Best wishes,
Peng