<<

Contents

Search

>>

 

WRITECOMM$

 

 

Function

 

 

Syntax:

WRITECOMM$(<File Number>,<Data>)

 

<File Number>

= <NUM-EXPRESSION>

<Data>

= <STRING-EXPRESSION>

 

 

Meaning:

Write data to a serial port.

 

WRITECOMM$ returns a string which contains separated by semi-colons the error code and the number of the written characters. The error code = 0 if the data could be written successfully, otherwise –1.

 

Parameter:

File Number

File number returned by OPENCOMM$

Data

Data to write

 

Sample:

H$ = OPENCOMM$("COM1","9600,n,8,1",1024)

RET% = VAL(SUBSTR$(H$,";",1))

FILENR% = VAL(SUBSTR$(H$,";",2))

IF RET% <> 0

THEN ... Error ...

ENDIF

 

H$ = WRITECOMM$(FILENR%,"Hello World")

RET% = VAL(SUBSTR$(H$,";",1))

NUMBER_WRITTEN% = VAL(SUBSTR$(H$,";",2))

IF RET% <> 0

THEN ... Error ...

ENDIF

 

See also:

OPENCOMM$

READCOMM$

CLOSECOMM