Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:26 13 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Micromite Plus: DIR$(fspec) bug with long fspec file name

Author Message
erbp
Senior Member

Joined: 03/05/2016
Location: Australia
Posts: 195
Posted: 10:44am 24 Sep 2019
Copy link to clipboard 
Print this post

I guess this one will be for Geoff.

Using MMBasic 5.05.02 Beta 1 on a MM+ (E100) I have found that the DIR$(fspec) function incorrectly reports that a file does NOT exist when it's name is entered as the fspec parameter and the file name is longer than 31 characters. The same applies if using wildcards in the fspec parameter too - see below.

Micromite Plus MMBasic Ver 5.05.02 Beta 1
Copyright 2011-2018 Geoff Graham

> CHDIR "LOGS"
> FILES
A:/LOGS
      743  Test12345678901234567890123.log
      743  Test123456789012345678901234.log
0 directories, 2 files
>
> DIM FN$
> FN$ = DIR$("Test12345678901234567890123.log",file): ? FN$    <ok with fspec at 31 chars
Test12345678901234567890123.log
> FN$ = DIR$("Test123456789012345678901234.log",file): ? FN$   <no match if fspec > 31 chars

> FN$ = DIR$("Test12345678901234567890123*.log",file): ? FN$

> FN$ = DIR$("Test123456789012345678901234.lo*",file): ? FN$

> FN$ = DIR$("Test123456789012345678901234.*",file): ? FN$     <ok, when fspec shorter again
Test123456789012345678901234.log
>


Regards,
Phil
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10573
Posted: 11:08am 24 Sep 2019
Copy link to clipboard 
Print this post

The maximum filename length for pattern matching is 31 characters - just a question of memory usage
 
erbp
Senior Member

Joined: 03/05/2016
Location: Australia
Posts: 195
Posted: 11:13am 24 Sep 2019
Copy link to clipboard 
Print this post

Hi Peter,

Thanks do you know if that is specified in any of the manuals? I looked before I posted but couldn't find anything that appeared relevant. Did I miss it?

Phil.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 09:21am 25 Sep 2019
Copy link to clipboard 
Print this post

No, it is not mentioned anywhere... one of those things that slipped past.  I will remove this limitation in the next version.

Geoff
Geoff Graham - http://geoffg.net
 
erbp
Senior Member

Joined: 03/05/2016
Location: Australia
Posts: 195
Posted: 09:59am 25 Sep 2019
Copy link to clipboard 
Print this post

Hi Geoff,

Thanks - I understand if there does need to be some limitation on the pattern matching that can be applied, but if there is then it should throw an error if that limit is exceeded - not just return an incorrect answer which the calling code will interpret as being fact.

Cheers,
Phil.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025