Open file with ostream with file name from QFile?
I want to output some text by using C++'s ostream but it appears that QFile::fileName() mangles the text string. Is there a way to open a file through ofstream through the string provided by QFile::fileName()?
As for your question. Its possible to pass qfile::filename() to the open call from ofstream.
You only have to add .toascii or .tolatin1 to it.
vinb: You usually want to use "toLocal8Bit()" for conversions like that. Both toAscii and even toLatin1 do not work well when a user has non-Latin characters in his file names.
thanks for correcting me, Tobias Hunger. :)