Here is the code I am trying with:
ifstream fileReader("server_data\\test2.jpg", ios::in | ios::binary);
char buffer[RESP_LENGTH];
memset(buffer, '\0', RESP_LENGTH);
if (fileReader.is_open())
{
fileReader.seekg(0);
fileReader.read(buffer, RESP_LENGTH);
cout << buffer<<endl<<"Length: "<<strlen(buffer);
}
fileReader.close();
Its simply reading only first few bytes. Its also differing from file to file.
I am suspecting, probably its getting a character which evaluates to NULL and thus my length and string is getting small portion only?
Any Idea what is really happening and how to fix it?