Put Statement [Runtime]/text/sbasic/shared/03020204.xhpSun Microsystems, Inc.converted from old format - fpePut statementPut Statement [Runtime]Writes a record to a relative file or a sequence of bytes to a binary file.See also: Get statementSyntax:Put [#] FileNumber As Integer, [position], VariableParameters:FileNumber: Any integer expression that defines the file that you want to write to.Position: For relative files (random access files), the number of the record that you want to write.For binary files (binary access), the position of the byte in the file where you want to start writing.Variable: Name of the variable that you want to write to the file.Note for relative files: If the contents of this variable does not match the length of the record that is specified in the Len clause of the Open statement, the space between the end of the newly written record and the next record is padded with existing data from the file that you are writing to.Note for binary files: The contents of the variables are written to the specified position, and the file pointer is inserted directly after the last byte. No space is left between the records.Example:Sub ExampleRandomAccessDim iNumber As IntegerDim sText As Variant REM Must be a variant typeDim aFile As StringaFile = "c:\data.txt"iNumber = FreefileOpen aFile For Random As #iNumber Len=32Seek #iNumber,1 REM Position to start writingPut #iNumber,, "This is the first line of text" REM Fill line with textPut #iNumber,, "This is the second line of text"Put #iNumber,, "This is the third line of text"Seek #iNumber,2Get #iNumber,,sTextPrint sTextClose #iNumberiNumber = FreefileOpen aFile For Random As #iNumber Len=32Get #iNumber,2,sTextPut #iNumber,,"This is new text"Get #iNumber,1,sTextGet #iNumber,2,sTextPut #iNumber,20,"This is the text in record 20"Print Lof(#iNumber)Close #iNumberend sub