Hello,
I reformulate the question in one other way:
see this piece of code:
ifstream file (name, ios::binary);
file.seekg (0, ios::end);
size = file.tellg();
_buffer = new char [size];
file.seekg (0, ios::beg);
file.read (_buffer, size);
//_buffer[size] = '\0';
cout << "size " << size << endl;
cout << " _buffer\n\n" << _buffer << endl;
ifstream file (name, ios::binary);
file.seekg (0, ios::end);
size = file.tellg();
_buffer = new char [size];
file.seekg (0, ios::beg);
file.read (_buffer, size);
//_buffer[size] = '\0';
cout << "size " << size << endl;
cout << " _buffer\n\n" << _buffer << endl;
To copy to clipboard, switch view to plain text mode
I open this file and then, when I print _buffer, I see at its end "strange" characters; the only way to get out they, is to put the '\0' at size position. Is it right this or I'm doing wrong anything?
thanks a lot
Bookmarks