How to read an 8 bit Raw Image
What I would like to do is read
a raw Image in decimal (8 bits, so value 0 - 255)
The code below is something I have started. When I tested it prints out numbers, letters, and ! ? etc.
I understand I am using char, but I should be getting just numbers.
If I do int it prints -858993460 sixteen times.
Am I missing something or am I using the wrong file opener or is there something else I should be using?
Code:
char data[1024];
ifstream inStream;
inStream.open("test.raw");
if(inStream.fail())
{
cout << "Input file opening failed.\n";
exit(1);
}
while(!inStream.eof())
{
inStream >> data[i];
cout << data[i] << endl;
i++;
while(i == 16);
}