``

prev Menu next

Original Enhancement (files)
`SET #Channel_number : ENDOFLINE string_expression`
sets the end-of-line (or end-of-record) character that is used on the statements PRINT, INPUT, LINE INPUT, WRITE, READ.
Available values for string_expression are CHR$(13)&CHR$(10), CHR$(13) or CHR$(10).
The default EOL is CHR$(13)&CHR$(10).
CHARACTER INPUT statements ignore the setting made by this statement.
`ASK #Channel_Number : FILESIZE numeric_variable`
The file size in bytes is assigned to numeric_variable.

`SET DIRECTORY a$`
changes the current directory to the directory that a string expression a$ indicates.
`ASK DIRECTORY s$`
assigns the string that indicates the current directory to a string variable s$.

`FILE GETNAME s$
FILE GETNAME s$, string_expression
` displays an open-file-dialog and assigns the file name to a string variable s$,
where string_expression indicates the default extension.

`FILE GETOPENNAME s$
FILE GETOPENNAME s$, string_expression
` displays an open-file-dialog and assigns the file name to a string variable s$.
No exisiting file cannot be assigned.

`FILE GETSAVENAME s$
FILE GETSAVENAME s$, string_expression
` displays an save-file-dialog and assigns the file name to a string variable s$.

`FILE SPLITNAME (a$) path$, name$, ext$`
splits the path name given by a string expression a$ into three parts, the path, the name body, and the extension, and assigns them to string variables path$, name$, ext$, respectively.

`FILE RENAME a$,b$`
renames the file a$ to b$, where a$, b$ are string expressions.
If the file a$ does not exist, an exception of extype 9003 shall be raised,
if the file b$ already exists, an exception of extype 9004 shall be raised,
and if renaming failed by another reason, an excetion of extype 9000 shall be raised.

`FILE DELETE a$`
deletes the file a$, where a$ is a string expression.
If the file does not exist, an exception of extype 9003 shall be raised, and if deleting failed by another reason, an exception of extype 9000 shall be raised.
This corresponds to UNSAVE of True BASIC and KILL of Microsoft BASIC.

`FILE LIST a$,s$`
assigns the whole list of the files that match a$ to s$,
where a$ is a string expression and s$ is a 1-dimensional string array.
a$ may have wildcard characters.
The upper bound of s$ shall be changed according to the number of the files matching.
However, if no file matches, an exception of extype 6005 shall be raised,
and if the number of the files exceeds the capacity of the array, an exception of 5001 shall be raised.

Supplied Functions
FILES(a$)
The number of the files that match a$, where a$ is a string expression. 0 if no file matches.

Example.
A program that changes all letters contained in the directed file in upper case.

    100 FILE GETNAME s$
    110 FILE SPLITNAME(s$) path$,name$,ext$
    120 LET t$=path$ & name$ & ".TMP"
    130 OPEN #1:NAME s$
    140 OPEN #2:NAME t$
    150 ERASE #2
    160 DO
    170    LINE INPUT #1,IF MISSING THEN EXIT DO:line$
    180    ET line$=UCASE$(line$)
    190    PRINT #2:line$
    200 LOOP
    210 CLOSE #2
    220 CLOSE #1
    230 FILE DELETE s$
    240 FILE RENAME t$,s$
    250 END

An example of using FILES and FILE LIST

    10 LET s$="c:\BASICw32\sample\*.bas"
    20 LET n=FILES(s$)
    30 IF n>0 THEN
    40    DIM names$(n)
    50    FILE LIST s$, names$
    60    MAT PRINT names$
    70 END IF
    80 END

`DIRECTORY GETNAME s$
` displays a folder-select-dialog to assigns the directory name to a string variable s$.
`MAKE DIRECTORY string_expression
` make the dorectory.
`REMOVE DIRECTORY string_expression
` make the dorectory.