As in the title, when read a content of file i find it reads unknown symbols with the content.
The code:
char *buff = NULL;
size_t size = 0;
ifstream file("c:\\file.txt", ios::out);
if(!file){
cout << "File does not open." << endl;
}
file.seekg(0, file.end);
size = file.tellg();
file.seekg(0, file.beg);
buff = new char[size];
while(!file.eof()){
file.read(buff, size);
}
cout << buff << endl;
delete[] buff;
The file content:
Hello world!.
Thank you for help.
The result:
As you seen in the previous image, there are many unknowns symbols.
Why these symbols appear, what's wrong in my code ?