hi everyone
I'm trying to listing files/drives/folders in pc but I couldnt find anything.
please help me ..
--[ cryptacker ]--
hi everyone
I'm trying to listing files/drives/folders in pc but I couldnt find anything.
please help me ..
--[ cryptacker ]--
depends on the operating system.
for windows
Here is how to get a list of the drive letters
#include <windows.h>
#include <iostream>
int main()
{
char buf[255];
char cDrive;
// get the drive letters as a set of strings
int sz = GetLogicalDriveStrings(sizeof(buf), buf);
if( sz > 0)
{
// buf now contains a list of all the drive letters. Each drive letter is
// terminated with '\0' and the last one is terminated by two consecutive '\0' bytes.
char* p1 = buf;
char* p2;
while( *p1 != '\0' && (p2 = strchr(p1,'\0')) != NULL )
{
std::cout << p1 << "\n";
p1 = p2+1;
}
}
else
{
// Oops! something went wrong so display the error message
DWORD dwError = GetLastError();
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, dwError, 0, buf, sizeof(buf), 0);
std::cout << buf << "\n";
}
}
For the files that are in the drives you need to use FindFirstFile() and FindNextFile(). Google and you will find examples.
thx for all, i will try.
See the MS samples from SDK and on Professional Win32 group http://tinyurl.com/yjy3ajr
(from Windows source code itself...)
See the MS samples from SDK and on Professional Win32 group http://tinyurl.com/yjy3ajr
(from Windows source code itself...)
That was not the same question, although good to know too :)
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.