Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Doesn't show all the files in system("dir")
Hi dear friends.
I have 6 files in C://Windows/System32/ras
when I run cmd.exe and type dir it shows all the 6 files but when I use these syntax in QT :
It shows only 4 files. why?
JonB last edited by JonB
Probably something to do with 32- vs 64-bit-ness, or permissions, or the fact that it's in
Windows/System32which Windows has special handling for, or something like that; who knows given that you don't show the output.
However, it's a bit irrelevant as you should not be using either
system(), nor should you use
diras a command to find out what files exist in any case. Look at https://doc.qt.io/qt-5/qdir.html#entryList-1 or https://doc.qt.io/qt-5/qdir.html#entryInfoList-1 and start from there.
this is out put form QT :
07/14/2009 07:50 AM <DIR> .
07/14/2009 07:50 AM <DIR> ..
06/11/2009 02:09 AM 735 cis.scp
06/11/2009 02:09 AM 14,529 pad.inf
06/11/2009 02:09 AM 2,817 pppmenu.scp
06/11/2009 02:09 AM 6,235 switch.inf
4 File(s) 24,316 bytes
2 Dir(s) 40,612,597,760 bytes free
and this is out put form CMD.exe :
08/28/2019 04:54 PM <DIR> .
08/28/2019 04:54 PM <DIR> ..
06/11/2009 01:29 AM 735 cis.scp
06/11/2009 01:29 AM 14,529 pad.inf
06/11/2009 01:29 AM 2,817 pppmenu.scp
06/11/2009 01:29 AM 6,235 switch.inf
08/28/2019 01:59 PM 44,575 temp.pbk
08/28/2019 01:58 PM 44,575 temp.txt
6 File(s) 113,466 bytes
2 Dir(s) 40,612,581,376 bytes free
as you can see , It doesn't show temp.txt and temp.pbk
I must use system() , because I want run cmd.exe in background my software and run some windows command .
JonB last edited by
Purely at a guess, since they are
tempfiles, and have been created right now, they do not exist when you try from your Qt program but they do when you try from the Command Prompt, or they are appearing on a schedule, or something. I do not believe there will be any difference between the two different ways of running
dir(except for possibly the permissions I mentioned).
solved but It was not about the level of access.
I set Run Environment in System Environment in QT Creator.
thanks for your suggestion.