I have RAW file in grayscale with 8-bit data and I'm trying to read the data using simple program:
#include <fstream>
#include <iostream>
using namespace std;
int main(){
char fileName[80] = "TEST.raw";
//char buffer[255];
ifstream fin(fileName);
char ch;
int i = 0;
while (fin.get(ch)){
cout << (unsigned int)ch << " ";
i++;
}
cout << endl;
cout << "i = " << i;
fin.close();
cin >> ch;
}
Some of values are higher than some specific value and I'm getting strange output. When i should get something like this:
(...) 34 34 34 36 43 59 88 123 151 166 (...)
i have:
(...) 34 34 34 36 43 59 88 123 4294967191 4294967206 (...)
I guess it's simple problem, but I have no idea how to do it correctly.