Operation IO on files
-
I have problem i read from file that
@//Odzczyt plikuQFile file_2("D:\\Prosit\\veryf.txt");
// QFile file_2("veryf.txt");
if (!file_2.open(QIODevice::ReadOnly | QIODevice::Text))
return;QTextStream in(&file_2); while (!in.atEnd()) { QString zm_ver = in.readLine(); ui->line_veryf->setText(zm_ver); file_2.close(); QFile::remove("D:\\Prosit\\veryf.txt");
@
And on Win7 all is working
On one XP working without full path (comment)
On second Xp dont working with full path or without full pathSomeone have any idea
Thanks for help -
Welcome to this forum
Without knowing the file structures on your PCs it is difficult to give a proper answer.
However, the first suggestions would be to check the existence of the files.
The D drive is usually not on all systems.
How about the directory?
Is the file present, where you assume it should be? -
file structures is on 100 % procent is ok.
On one computer when i run from QT (debug or realese) is working if i run exe file from another place on this komputer is dosn't work.
File is i sure is exist becouse now i make it manual by notepad. -
Qt always uses '/' as a path separator for filenames, but that should not effect your code.
Have you tried using QFile's error(...) method to find out why the open failed?
-
Have you tried using QFile’s error(…) method to find out why the open failed?
I am totally agree with Tobias. Qt extends many debug tools. You can use QFile errors as example.
Good luck!
-
Problem is exist with amplication which have trigers on catalog. I make bat file and add to triger which copy files to another folder and i read and all is ok. This strange becouse if I use anothers programs i try with OpenOffice make some docs read write and all is worked...
Is exist any other mechanism to operations on files in QT ??
This is problem if which can give some problems with programs like antivirus -
So what is the error QFile reports? That should give a good hint as to what is causing the issue.
-
[quote author="tczaude" date="1320312689"]On second Xp dont working with full path or without full path
[/quote]
Check permissions.
Check directory tree.
Check drive letters.report some concrete error (use qdebug, qfile::error and so on).
-
Problem is Solved DOS use / not \ and i must do when i run program go to root directory by cd...
I make bat file which have cd c:\ and run program and problem is not existThanks everybody