المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Choosing files from a directory



C++ Programming
09-13-2010, 03:23 AM
Hi all. I have a console application, running under Windows, that asks for a folder or directory and includes those files it supports and leave the rest. The following code is part of the definition of the function that does it:

....
....

char filePath[280] = {0};

....
....

strcat(filePath, "*.mp3");

....
....


The application searches the folder for files to add. The above code works when FindFirstFile() is called. But I want a way through which other file extensions (e.g. .wav., .wma, etc) can be included so that files with these other file extensions will be returned. I did something as follows, which I only guessed as I did not know how to do it, and it did not work:



strcat(filePath, "*.mp3;*.wav;*.wma");


When FindFirstFile() is called, it returns INVALID_HANDLE_VALUE;
I need help on how to solve this problem. Thanks.