View Full Version : Work with directory and files
amiref
23rd March 2011, 19:47
Hi
I want to write a function that give a path from user and put addresses of whole files and directory ( everything that is in that address ) in the QStringList . How can I do this ?
ps : I try this with QDir and QFileInfo but I can't success . please help me .
SixDegrees
23rd March 2011, 19:54
QDir.entryList()
QDir.entryInfoList()
depending on what you're trying to accomplish.
amiref
23rd March 2011, 20:37
My program must do exactly these works :
1 - I want from user to input a path like "C:\Qt\4.7.2\bin"
2 - My program give this address .
3 - My program puts absolute address of every file in user's path( in example "C:\Qt\4.7.2\bin" ) in the QStringList seperatly . for example after user write "C:\Qt\4.7.2\bin" my program puts every of these below addresses in QStringList :
(I think that I define QStringList stl )
stl[0] = "C:\Qt\4.7.2\bin\assistant.exe"
stl[1] = "C:\Qt\4.7.2\bin\createpackage"
stl[2] = "C:\Qt\4.7.2\bin\createpackage.bat"
stl[3] = "C:\Qt\4.7.2\bincreatepackage.pl"
....
please help me.
thanks.
SixDegrees
23rd March 2011, 20:43
Read the documentation for the functions I listed above. Either one will do what you want.
amiref
24th March 2011, 09:26
Thank you very much, the tip was very usefull.Now I have a another question :
I have a QStringList considering previous posts ( now my QStringList include some address of different files ) . How can I purge that QStringList so only files with .txt format exist in my QStringList ?
Please help me.
thank you
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.