Hi.
Ich möchte von meiner platte alle z.B.: mp3s finden.
Bekomme es aber einfach nicht hin.
Habe es mal mit fstream probiert, jedoch ohne erfolg.
Bin mom. so weit:
C/C++ Code:
#include <iostream>
#include "windows.h"
/* Search possible Datas */
void main(void)
{
WIN32_FIND_DATA FileData; // Data structure describes the file found
HANDLE hSearch; // Search handle returned by FindFirstFile
TCHAR szMsg[100]; // String to store the error message
TCHAR szDirPath[] = TEXT("TEXTRO");
BOOL bFinished = FALSE;
// Start searching in the root directory
hSearch = FindFirstFile (TEXT("*.mp3"), &FileData);
if (hSearch == INVALID_HANDLE_VALUE)
{
wsprintf (szMsg, TEXT("No files found."));
return;
}
while (!bFinished)
{
//OpenFolderPath(FileData.cFileName);
printf (FileData.cFileName);
if (!FindNextFile (hSearch, &FileData))
{
bFinished = TRUE;
if (GetLastError () == ERROR_NO_MORE_FILES)
{
wsprintf (szMsg, TEXT("Found all of the files."));
}
else
{
wsprintf (szMsg, TEXT("Unable to find next file."));
}
}
}
// Close the search handle.
if (!FindClose (hSearch))
wsprintf (szMsg, TEXT("Unable to close search handle."));
}
Bin für jede hilfe dankbar!
mfg sibob
p.s.
MS Studio c++ 6
windows 2k
Ich möchte von meiner platte alle z.B.: mp3s finden.
Bekomme es aber einfach nicht hin.
Habe es mal mit fstream probiert, jedoch ohne erfolg.
Bin mom. so weit:
C/C++ Code:
#include <iostream>
#include "windows.h"
/* Search possible Datas */
void main(void)
{
WIN32_FIND_DATA FileData; // Data structure describes the file found
HANDLE hSearch; // Search handle returned by FindFirstFile
TCHAR szMsg[100]; // String to store the error message
TCHAR szDirPath[] = TEXT("TEXTRO");
BOOL bFinished = FALSE;
// Start searching in the root directory
hSearch = FindFirstFile (TEXT("*.mp3"), &FileData);
if (hSearch == INVALID_HANDLE_VALUE)
{
wsprintf (szMsg, TEXT("No files found."));
return;
}
while (!bFinished)
{
//OpenFolderPath(FileData.cFileName);
printf (FileData.cFileName);
if (!FindNextFile (hSearch, &FileData))
{
bFinished = TRUE;
if (GetLastError () == ERROR_NO_MORE_FILES)
{
wsprintf (szMsg, TEXT("Found all of the files."));
}
else
{
wsprintf (szMsg, TEXT("Unable to find next file."));
}
}
}
// Close the search handle.
if (!FindClose (hSearch))
wsprintf (szMsg, TEXT("Unable to close search handle."));
}
Bin für jede hilfe dankbar!
mfg sibob
p.s.
MS Studio c++ 6
windows 2k