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 :
QDir::setCurrent("C://Windows/System32/ras");
system("dir");
It shows only 4 files. why? -
@saeidparand
Probably something to do with 32- vs 64-bit-ness, or permissions, or the fact that it's inWindows/System32
which 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 usedir
as 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. -
@jonb
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 freeand 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 -
@saeidparand
Purely at a guess, since they aretemp
files, 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 runningdir
(except for possibly the permissions I mentioned).