I don't know how to do it in C++, but Dark GDK supports this with:
dbDir
This command will output the entire contents of the current working directory to the screen. The command serves little use for effective file scanning, but provides a simple way to view files.
Syntax
void dbDir ( void )
dbFindFirst
This command will begin a file search by locating the first file in the current working directory. If this command succeeds, a file will be stored internally and its data can be extracted using the dbGetFileName$, dbGetFileDate$ and dbGetFileType commands.
Syntax
void dbFindFirst ( void )
dbFindNext
This command will continue a file search by locating the next file in the current working directory. If this command succeeds, a file will be stored internally and its data can be extracted using the dbGetFileName$, dbGetFileDate$ and dbGetFileType commands. A file search can be started with the dbFindFirst command.
Syntax
void dbFindNext ( void )
Your_Health = (My_Mood == HAPPY) ? 100 : NULL;