[fpc-pascal] findfirst wildcards...

Ralf Quint freedos.la at gmail.com
Wed Dec 3 21:02:30 CET 2014

On 12/3/2014 8:30 AM, waldo kitty wrote:
> On 12/3/2014 3:41 AM, Jonas Maebe wrote:
>> On 03 Dec 2014, at 06:05, waldo kitty wrote:
>>> can you help me understand the differences in the output of the 
>>> below program?
>>> given these three filenames: t.txt t1.txt t11.txt
>>> with mask  t?.txt  why does MatchesMaskList not show t.txt and 
>>> t11.txt like
>>> plain findfirst?
>> "?" means "a single arbitrary character".  findfirst with "t?.txt" 
>> should not
>> match t.txt nor t11.txt either.
> yes, i wrote t11.txt when i should have written t1.txt... my bad...
> however on
>   OS/2 native
>   OS/2 with 4OS2 command interpreter replacement
>   OS/2 DOS native
>   OS/2 DOS with 4DOS command interpreter replacement
>   Vista (32bit)
> t?.txt returns both t.txt and t1.txt...
On any DOS based OS (that includes OS/2 and Windows), the "?" wildcard 
character will find any character, including no character at all in that 
position. So in your example, t?.txt will find t.txt and tx.txt but not 
txy.txt. It will not return any filename longer than your search mask, 
but return shorter filenames. This is (should be) a functionality of the 
underlying system calls.
On *ix based systems, the filenames are evaluated by the shell, not the 
OS, and your search result will be different in a lot of cases...


This email has been checked for viruses by Avast antivirus software.

More information about the fpc-pascal mailing list