Why does this fail, it's supposed to be simple and work ?
fisier.seekg(0, ios::end);
long lungime = fisier.tellg();
This returns a larger value than that of the file resulting in a wrong
char *continut = new char[lungime];
Any idea what the problem could be ?
I also tried counting to the end of the file one char at a time, that rendered the same result, a higher number than expected. But upon using getline() to read one line at a time, it works, there are no extra spaces...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…