I am reading from a ascii file, which contains information from a picture. The file looks like
1,434,341,158,498,... until the end of a row of pixels. The next pixel row then starts below 5,316,211,323,269,... etc repeating until all pixels have been covered.
I am trying to use getline() to write these data values to an array for processing. The part of my code responsible for exacting the value is as follows:
while(!asciiimage.eof()){
string pixelvalue;
getline(asciiimage, pixelvalue, ',');
cout << pixelvalue << endl;
}
This loops until the end of the file. This works fine for one row of pixels, however at the end of the row of pixels the cout look something like this:
115
134
465
200
with a gap inbetween the values. I would like to detect this gap. I have tried to detect it using
pixelvalue.length();
pixelvalue.size();
but both of these were unsuccessful. How else can i detect this blank value of pixelvalue?