Hi
I have a problem with the following code.
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
int i;
int me;
char * Buffer;
ifstream inFile (argv[1], ios::binary );
if (!inFile) {
cerr << "Unable to open image file";
exit(1);
}
int myBuffLen;
inFile.seekg (0, ios::end);
myBuffLen = inFile.tellg();
inFile.seekg (0, ios::beg);
Buffer = new char [myBuffLen];
inFile.read(Buffer, myBuffLen);
cout << Buffer;
inFile.close();
free(Buffer);
return 0;
}
A very simple code for reading binarry files but when I run the problem it prints only "ÿØÿáøExifof" when i set the file to be an image jpeg file.
Any one can help?
Thanks in advance!