The comments are in danish so you probably wont understand them, but since the code is fairly simple I don't think it will be a problem.
The error is this:
If you are to load a file that contains nothing but a sign (like 'g') and exactly "one" new line (that is '/n' - though it with dos is "/r/n") then there will be added one more sign to the loaded text -WHY!
Code:AnsiString TTextFile::Load() const { AnsiString Buffer; int Length; ifstream File(itsPath.c_str()); if (File.is_open()) { File.seekg(0, ios::end); Length = File.tellg(); Buffer.SetLength(Length + 1); File.clear(); /* File nulstilles så funktioner som eof(), fail(), good() og bad() retunere det som de altid gør når en ny stream bliver lavet. */ File.seekg(0, ios::beg); /* File's itterator (pointeren der peger på det tegn der ved næste kald skal læses eller overskrives) //bliver sat tilbage til starten af filen */ File.read(Buffer.c_str(), Length); Buffer[Length + 1] = '\0'; File.close(); } return Buffer; }



LinkBack URL
About LinkBacks




- Besides... I've checked.