Solved QT FILE OPERATION
-
@swansorter User data is usually stored in user home directory.
Check https://doc.qt.io/qt-5/qstandardpaths.html to see how to get various standard locations. -
@swansorter said in QT FILE OPERATION:
1.file creation not happening
What did you do about printing
QFile::error
/errorString()
if file open fails? -
@JonB getting error 5
-
@jsulm i will check
-
@swansorter said in QT FILE OPERATION:
@JonB getting error 5
That is what
QFile::errorString()
reports? -
@JonB yea
-
@swansorter said in QT FILE OPERATION:
QFile mainsort(QDir::current().path()+"/ms.csv");
I don't think this is a good idea to do this, at least with a global variable!
Have you checked, on the Nano pc on which path you tried to write?
Have you checked the directory is writable / the application is allowed to write there? -
@swansorter
Slightly strange that you just get a number, and it seems to mean I/O Error, which is also a touch strange.Nevertheless, @jsulm has told you above what you need to use. Pick a
QStandardPaths
suitable for the user to have write permission, for exampleQStandardPaths::HomeLocation
.3.i wanted place file where my application file is located
This is a bad idea. The application file/executable is likely to be placed in a directory to which the user does not have write access, and anyway it's not a good place for data files.
-
@JonB thank very much.
i created separate folder for file operation in home location -
@KroMignon thank you sir for your information