[SOLVED] Creation and writing to .dat file using QFile on Windows some problem...
-
-
outputDir is absolute path that contains drive letter and "/" separators and all that passed to QFile constructor but file is not created and file.fileName() returns fileName + outputDir with the "/" separators like Qt did not take care of conversion but should.
I try to find the possible miss here ( solution ) , if you have time help me.
Thank you. -
mlong please read my previous post I've wrote there what is in outputDir ( directory name with "/" separators ) and there is some windows friendly file name with .dat extension in fileName. That passed to the QFile constructor and I expect separators are automatically converted to "" for Windows but as you can see they didn't. So I'm looking what is the problem...
-
[quote author="Pavel Mazniker" date="1312828520"]mlong please read my previous post I've wrote there ...[/quote]
I realize that. I was just looking for a more concrete example "E:/foo/bar/baz/file.dat" or whatever... just to make sure that there's not something else subtle that is happening in your use case.
I believe that file.fileName() will not return the "" separators. It will continue to use the Qt-friendly "/" separators. The "/" and "" conversion happens at a lower level.
-
Without more information, it's hard to tell. Qt's pretty robust in opening files, so I would be led to believe that there's more than likely something subtle in the way the file and/or path is being set up. Could you create and post a small example snippet of code (very similar to your first posts's code sample) which has a real path and filename which is not working?
-
Pavel, it's time to post some concrete examples. Your "anonymized" snippets are hard to analyze. Some actual paths, as mlong suggested, would be very helpful.
Qt does its job with files pretty good. So it is very likely that you messed up some paths.
Double check the actual paths with [[Doc:QFileInfo]]:
@
QFileInfo fi(file);
qDebug() << fi.absoluteFilePath();
@