FWRITE statement

Purpose: FWRITE writes quoted, comma separated strings to a file, commonly a .csv type file.


 Syntax:

 FWRITE hFile, Comma,Separated,Expressions [;]

 Parameters:

  • hFile Name of handle to file to which strings are written.
  • Comma,Separated,Expressions one or more expressions to be written. An expression can be a literal or variable number or string, a member of an array or a user defined type, or an inlined function. The expressions will be separated with commas and quotation marks will encase the string variables when they are written to the file.
  • ; [OPTIONAL] A semi-colon at end of a FWRITE statement line suppresses linefeed and causes the next FWRITE parameter to print to file on the same line as the previous FWRITE.

Example:


 DIM a$, b$, c$

 a$ = "three"
 b$ = "four"
 c$ = "five"

 OPEN "Data.csv" FOR OUTPUT AS FP1

 FWRITE FP1, "one","two",a$,b$,c$

 CLOSE FP1

Result:

"one","two","three","four","five" is written to the file Data.csv.