The line from the file doesn't corroborate itself.
-
std::fstream * file; std::string strBuf; file = new std::fstream; file -> open ( "/path/to/file" ); while ( !file -> eof() ) { getline ( *file, strBuf ); std::cout << "PREFIX" << strBuf << "POSTFIX" << std::endl; }
Let's say, "some text" in the file. Result of:
POSTFIXome text
If the length of the prefix and postage is equal, for example:
std::cout << "PREFIX0" << strBuf << "POSTFIX" << std::endl;
♪
POSTFIXsome text
The content of strBuf is then copied in char*, with the same behaviour as char*. Anyway, I don't care what drives out. This variable contains the name of another file (music) to be opened. But it doesn't work out.
-
As the user @Mike has said in the comments on the question, the problem is in /r. It's decided:
size_t pos = 0; while ( ( pos = file.find("\r", pos) ) != std::string::npos ) { file.replace(pos, 2, ""); }