|
WriteLine |
Top Previous Next |
|
The WriteLine function writes an optional list of string expressions to a file that was previously opened with OpenWrite and writes the Windows end-of-line character sequence after all the expressions.
If no expressions are supplied then WriteLine just writes the end-of-line character sequence. For Windows, the end-of-line sequence is ASCII character 10 for Line Feed. Windows text file editors like NotePad will interpret this sequence as the start of a new line. If more than one parameter is passed, they are separated by commas for ease of using CSV format in excel.
Syntax
fileManager.WriteLine( fileNumber, [ expression , expressionTwo ... ] )
Parameters
Example VARIABLES: lineString TYPE: String VARIABLES: fileNumber TYPE: Integer
' Open the file. fileNumber = fileManager.OpenWrite( "C:\FileToOpen.txt" )
IF fileNumber > 0 THEN
' Construct the line. lineString = instrument.symbol + "," + instrument.close
' Write out the line to the current file. fileManager.WriteLine( fileNumber, lineString )
' Another format for the above. fileManager.WriteLine( fileNumber, instrument.symbol, instrument.close )
' Close the file. fileManager.Close( fileNumber )
ENDIF |