From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- .../source/text/sbasic/shared/03020204.xhp | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 helpcontent2/source/text/sbasic/shared/03020204.xhp (limited to 'helpcontent2/source/text/sbasic/shared/03020204.xhp') diff --git a/helpcontent2/source/text/sbasic/shared/03020204.xhp b/helpcontent2/source/text/sbasic/shared/03020204.xhp new file mode 100644 index 000000000..79a276ecd --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/03020204.xhp @@ -0,0 +1,85 @@ + + + + + + + Put Statement + /text/sbasic/shared/03020204.xhp + + + + + + +
+ + Put statement + + + +Put Statement +Writes a record to a relative file or a sequence of bytes to a binary file. +
+See also: Get statement + +Syntax: + +Put [#] FileNumber As Integer, [position], Variable + + +Parameters: + 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 ExampleRandomAccess +Dim iNumber As Integer +Dim sText As Variant ' Must be a variant type +Dim aFile As String + aFile = "c:\data.txt" + iNumber = Freefile + Open aFile For Random As #iNumber Len=32 + Seek #iNumber,1 ' Position To start writing + Put #iNumber,, "This is the first line of text" ' Fill line with text + Put #iNumber,, "This is the second line of text" + Put #iNumber,, "This is the third line of text" + Seek #iNumber,2 + Get #iNumber,,sText + Print sText + Close #iNumber + iNumber = Freefile + Open aFile For Random As #iNumber Len=32 + Get #iNumber,2,sText + Put #iNumber,,"This is new text" + Get #iNumber,1,sText + Get #iNumber,2,sText + Put #iNumber,20,"This is the text in record 20" + Print Lof(#iNumber) + Close #iNumber +End Sub + + + +
\ No newline at end of file -- cgit v1.2.3