Usando rdbuf secondo l'esempio
codice:
filebuf *pBuf;
pBuf = file.rdbuf();
long Len = pBuf->pubseekoff(0,ios::end,ios::in);
pBuf->pubseekoff(0,ios::beg,ios::in);
char *stringa = new char[Len];
pBuf->sgetn(stringa,Len);
string Stringa = stringa;
Ottengo comunque questi caratteri.
Anche provando a mettere il + 1 nel len (anche se nell'esempio non sembra essere richiesto).
Anche col tuo suggerimento
codice:
ifstream file;
file.open("F:/msg/mes.msg",ios::in);
file.seekg(0,ios::end);
long Len = file.tellg();
char *stringa = new char[Len + 1];
file.seekg(0,ios::beg);
file.read(stringa,Len);
stringa[Len] = 0;
string Stringa = stringa;
delete[] stringa;
file.close();
Ottengo le III...anche se mi sembra sbagliato perchè se faccio len + 1, il terminatore va su len + 1, credo.
Ho provato anche in quest'altro modo, ma niente.