Robert Wolfe
2009-02-01 18:33:07 UTC
Hi all!
I am using the latest PB/CC compiler and tried the following example from the help for DIR$:
DIM Listing$(1 TO 1000)
DIM x&, temp$
temp$ = DIR$("*.*", TO Listing(x&) )
WHILE LEN(temp$) AND x& < 1000 ' max = 1000
INCR x&
temp$ = DIR$(NEXT, TO Listing(x&) )
WEND
For some reason this would not allow the program to compile. In order to get what I want to
do working I had to use the following code:
SUB ShowConfigDir
DIM temp AS STRING
DIM t AS INTEGER
SHELL ENVIRON$("COMSPEC") + " /C dir /b /w *.cfg > tempdir"
OPEN "tempdir" FOR INPUT AS #1
WHILE NOT EOF(1)
LINE INPUT #1, temp
PRINT temp
WEND
CLOSE #1
KILL "tempdir"
END SUB
Now if there is a CORRECT way to do this using the DIR$ function, any pointers in that
direction would be greatly appreciated.
I am using the latest PB/CC compiler and tried the following example from the help for DIR$:
DIM Listing$(1 TO 1000)
DIM x&, temp$
temp$ = DIR$("*.*", TO Listing(x&) )
WHILE LEN(temp$) AND x& < 1000 ' max = 1000
INCR x&
temp$ = DIR$(NEXT, TO Listing(x&) )
WEND
For some reason this would not allow the program to compile. In order to get what I want to
do working I had to use the following code:
SUB ShowConfigDir
DIM temp AS STRING
DIM t AS INTEGER
SHELL ENVIRON$("COMSPEC") + " /C dir /b /w *.cfg > tempdir"
OPEN "tempdir" FOR INPUT AS #1
WHILE NOT EOF(1)
LINE INPUT #1, temp
PRINT temp
WEND
CLOSE #1
KILL "tempdir"
END SUB
Now if there is a CORRECT way to do this using the DIR$ function, any pointers in that
direction would be greatly appreciated.