DIR

From MCS Wiki AVR
Jump to: navigation, search

Contents

Action

Returns the filename that matches the specified file mask.

 

 

Syntax

sFile = DIR(mask)

sFile = DIR()

 

 

Remarks

SFile

A string variable that is assigned with the filename.

Mask

A file mask with a valid DOS file mask like *.TXT

 

Use *.* to select all files.

 

The first function call needs a file mask. All other calls do not need the file mask. In fact when you want to get the next filename from the directory, you must not provide a mask after the first call.

 

Dir() returns an empty string when there are no more files or when no file name is found that matches the mask.

 

 

See also

INITFILESYSTEM , OPEN , CLOSE , FLUSH , PRINT , LINE INPUT , LOC , LOF , EOF , FREEFILE , FILEATTR , SEEK , BSAVEBLOAD , KILL , DISKFREE , DISKSIZE , GET , PUT , FILELEN , FILEDATE , FILETIME , FILEDATETIME , WRITE , INPUTMKDIR , RMDIR , CHDIR

 

 

ASM

Calls

_Dir ; with file mask

_Dir0 ; without file mask

Input

X : points to the string with the mask

Z : points to the target variable

Output

 

 

 

 

 

Partial Example


'Lets have a look at the file we created
Print "Dir function demo"
S = Dir("*.*")
'The first call to the DIR() function must contain a file mask
' The * means everything.
'
While Len(s)> 0 ' if there was a file found
Print S ;" ";Filedate();" ";Filetime();" ";Filelen()
' print file , the date the fime was created/changed , the time and the size of the file
S = Dir()' get next
Wend

Languages   English Deutsch  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language