Behavior of GetFirstFile Function with Wildcards
Primary Software Version: 7.1
Primary Software Fixed Version: N/A
Secondary Software: N/A
When using the GetFirstFile function and the '?' wildcard, I observe unexpected behavior. In particular, I am trying to retrieve all files that are 8 characters long with the following code:
GetFirstFile ("\\????????.???", . . .);
Instead, the GetFirstFile function returns all the files in the specified search directory. Why am I seeing this behavior and is it to be expected?
On Win32 operating systems, the LabWindows/CVI GetFirstFile function is implemented using the Windows SDK FindFirstFile function. The FindFirstFile function accepts two kinds of wildcards: the asterisk (*) and the question mark (?). Since NTFS appeared, Win32 treats the '?' wildcard in special ways depending on the location and search pattern.
In particular, certain character combinations are given special meaning when used as wildcards. These rules apply to both long and short names. In general, the GetFirstFile and GetNextFile functions return matches similar to the dir shell command.
In order to get all files that are 8 characters long, consider using the '*.*' wildcard, and then filtering the results afterwards.
Microsoft SDK: FindFirstFile
Microsoft SDK: FindNextFile
Report Date: 12/27/2004
Last Updated: 01/04/2005
Document ID: 3GQL3BK7