WRITE

 

Action

Writes data to a sequential file

 

Syntax

Write #ch , data [,data1]

 

 Remarks

Ch

A channel number, which identifies an opened file. This can be a hard coded constant or a variable.

Data , data1

A variable who’s content are written to the file.

 

When you write a variables value, you do not write the binary representatrion but the ASCII representation. When you look in a file it contains readable text.

When you use PUT, to write binary info, the files are not readable or contain unreadable characters.

Strings written are surrounded by string delimeters "". Multiple variables written are separated by a comma. Consider this example :

Dim S as String * 10 , W as Word

S="hello" : W = 100

OPEN "test.txt" For OUTPUT as #1

WRITE #1, S , W

CLOSE #1

 

The file content will look like this : "hello",100

 

Use INPUT to read the values from value.

 

ASM

Calls

_FileWriteQuotationMark

_FileWriteDecInt

 

_FileWriteDecByte

_FileWriteDecWord

 

_FileWriteDecLong

_FileWriteDecSingle

Input

Z points to variable

 

Output

 

 

 

 

Example

Dim S As string * 10 , W As Word ,L As Long

S = "write"
Open "write.dmo" For Output As #2
Write #2 , S , W , L ' write is also supported
Close #2

Open "write.dmo" For Input As #2
Input #2 , S , W , L ' write is also supported
Close #2
Print S ; " " ; W ; " " ; L