WriteString

Top  Previous  Next

The WriteString function writes a list of string expressions to a file that was previously opened with OpenWrite. It does not write the windows end-of-line character like WriteLine does. If multiple parameters are passed, they are not separated by commas, so you can control the exact characters being output.

 

Syntax

 

fileManager.WriteString( fileNumber, expression [, expressionTwo ... ] )

 

Parameters

file number

 

file number if more than one file has been opened.

expression

 

the first string expression to write

expressionTwo

 

the second string expression to write (optional)

etc.

 

 

 

 

 

returns

 

nothing

 

Example

VARIABLES: lineString TYPE: String

VARIABLES: fileNumber TYPE: Integer

 

' Open the file.

fileNumber = fileManager.OpenWrite( "C:\FileToOpen.txt" )

 

IF fileNumber > 0 THEN

 

   ' Write out the date to the current file.

   fileManager.WriteString( fileNumber, instrument.date, "," )

 

   ' Construct another line.

  lineString = instrument.symbol + "," + instrument.close

 

   ' Write out the line to the current file.

   fileManager.WriteString( fileNumber, lineString )

 

   ' Write out the end-of-line character sequence.

   fileManager.WriteLine( fileNumber )

 

   ' Close the file.

   fileManager.Close( fileNumber )

 

ENDIF