ade_osfexpand

Land Desktop Development ARX CPP SDK

Up a level
ade_osfexpand
 
 

Searches a directory and returns a list of file names.

struct resbuf*

ade_osfexpand(

char* path,

char* extension,

char* pattern);

Returns a list of file names or NULL.

path Directory in which to search or NULL.
If NULL, the function searches the working directory.
extension File name extension or NULL. If NULL, the function uses "dwg".
pattern Wild card pattern or NULL. If NULL, the function uses "*" (search for all file names with the given extension and path).

You must release the resbuf.

For information about wild card patterns, look up "wild-card characters" on the Index tab of AutoCAD Map Help.

The following sample parses the resbuf returned by ade_osfexpand() and prints a list of matching files. Then it releases the resbuf, as required.

char* pszFilePath = "C:\\MyFiles";
char* pszFileExtension = "dwg";
char* pszFilePattern = NULL;
struct resbuf* pFileNamesRb = ade_osfexpand(pszFilePath, pszFileExtension, pszFilePattern);
while(pFileNamesRb != NULL) {
    acutPrintf(
        "\nThe following file of type \"%s\" were found in %s: %s"
        , pszFileExtension, pszFilePath, pFileNamesRb->resval.rstring);
    pFileNamesRb = pFileNamesRb->rbnext;
}
acutRelRb(pFileNamesRb);