From 7fc81eea6a91fca10c4e5b28601ebcf63fff2c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Timm?= Date: Fri, 26 Nov 2004 13:50:14 +0000 Subject: [PATCH] INTEGRATION: CWS helpcontentbeta (1.1.2); FILE MERGED 2004/09/16 11:45:16 fpe 1.1.2.1: Regular Update --- .../source/text/sbasic/shared/03020202.xhp | 112 +++++++++++------- .../source/text/sbasic/shared/03020203.xhp | 85 ++++++------- .../source/text/sbasic/shared/03020204.xhp | 101 ++++++++-------- .../source/text/sbasic/shared/03020205.xhp | 69 +++++------ .../source/text/sbasic/shared/03020301.xhp | 92 +++++++------- .../source/text/sbasic/shared/03020302.xhp | 45 +++---- 6 files changed, 267 insertions(+), 237 deletions(-) diff --git a/helpcontent2/source/text/sbasic/shared/03020202.xhp b/helpcontent2/source/text/sbasic/shared/03020202.xhp index b524fc9c3e..c25324c48d 100755 --- a/helpcontent2/source/text/sbasic/shared/03020202.xhp +++ b/helpcontent2/source/text/sbasic/shared/03020202.xhp @@ -52,58 +52,80 @@ * Contributor(s): _______________________________________ * * - ************************************************************************--> + ************************************************************************--> + + -Input# Statement [Runtime] +Input# Statement [Runtime] /text/sbasic/shared/03020202.xhp Sun Microsystems, Inc. -converted from old format - fpe +converted from old format - fpe - - -
- Input;functionInput# Statement [Runtime] - Reads data from an open sequential file. -
- Syntax: - Input #FileNumber As Integer; var1[, var2[, var3[,...]]] - Parameters: - FileNumber: Number of the file that contains the data that you want to read. The file must be opened with the Open statement using the key word INPUT. - var: A numeric or string variable that you assign the values read from the opened file to. - The Input# statement reads numeric values or strings from an open file and assigns the data to one or more variables. A numeric variable is read up to the first carriage return (Asc=13), line feed (Asc=10), space, or comma. String variables are read to up to the first carriage return (Asc=13), line feed (Asc=10), or comma. - Data and data types in the opened file must appear in the same order as the variables that are passed in the "var" parameter. If you assign non-numeric values to a numeric variable, "var" is assigned a value of "0". - Records that are separated by commas, commas cannot be assigned to a string variable. Quotation marks (") in the file are disregarded as well. If you want to read these characters from the file, use the Line Input# statement to read pure text files (files containing only printable characters) line by line. - If the end of the file is reached while reading a data element, an error occurs and the process is aborted. - Example: - Sub ExampleWorkWithAFile - Dim iNumber As Integer - Dim sLine As String - Dim aFile As String - Dim sMsg as String - aFile = "c:\data.txt" - - iNumber = Freefile - Open aFile For Output As #iNumber - Print #iNumber, "This is a line of text" - Print #iNumber, "This is another line of text" - Close #iNumber - - iNumber = Freefile - Open aFile For Input As iNumber - While not eof(iNumber) - Line Input #iNumber, sLine - If sLine <>"" then - sMsg = sMsg & sLine & chr(13) - end if - wend - Close #iNumber - Msgbox sMsg - End Sub - - +
+Input statement + +Input# Statement [Runtime] +Reads data from an open sequential file. +
+Syntax: +Input #FileNumber As Integer; var1[, var2[, var3[,...]]] +Parameters: + +FileNumber: Number of the file that contains the data that you want to read. The file must be opened with the Open statement using the key word INPUT. + +var: A numeric or string variable that you assign the values read from the opened file to. +The Input# statement reads numeric values or strings from an open file and assigns the data to one or more variables. A numeric variable is read up to the first carriage return (Asc=13), line feed (Asc=10), space, or comma. String variables are read to up to the first carriage return (Asc=13), line feed (Asc=10), or comma. +Data and data types in the opened file must appear in the same order as the variables that are passed in the "var" parameter. If you assign non-numeric values to a numeric variable, "var" is assigned a value of "0". +Records that are separated by commas, commas cannot be assigned to a string variable. Quotation marks (") in the file are disregarded as well. If you want to read these characters from the file, use the Line Input# statement to read pure text files (files containing only printable characters) line by line. +If the end of the file is reached while reading a data element, an error occurs and the process is aborted. +Example: +Sub ExampleWorkWithAFile +Dim iNumber As Integer +Dim sLine As String +Dim aFile As String +Dim sMsg as String +aFile = "c:\data.txt" +iNumber = Freefile +Open aFile For Output As #iNumber +Print #iNumber, "This is a line of text" +Print #iNumber, "This is another line of text" +Close #iNumber +iNumber = Freefile +Open aFile For Input As iNumber +While not eof(iNumber) +Line Input #iNumber, sLine +If sLine <>"" then +sMsg = sMsg & sLine & chr(13) +end if +wend +Close #iNumber +Msgbox sMsg +End SubSub ExampleWorkWithAFile +Dim iNumber As Integer +Dim sLine As String +Dim aFile As String +Dim sMsg as String +aFile = "c:\data.txt" +iNumber = Freefile +Open aFile For Output As #iNumber +Print #iNumber, "This is a line of text" +Print #iNumber, "This is another line of text" +Close #iNumber +iNumber = Freefile +Open aFile For Input As iNumber +While not eof(iNumber) +Line Input #iNumber, sLine +If sLine <>"" then +sMsg = sMsg & sLine & chr(13) +end if +wend +Close #iNumber +Msgbox sMsg +End Sub +
diff --git a/helpcontent2/source/text/sbasic/shared/03020203.xhp b/helpcontent2/source/text/sbasic/shared/03020203.xhp index 3a12b97e51..9971597f7f 100755 --- a/helpcontent2/source/text/sbasic/shared/03020203.xhp +++ b/helpcontent2/source/text/sbasic/shared/03020203.xhp @@ -52,55 +52,56 @@ * Contributor(s): _______________________________________ * * - ************************************************************************--> + ************************************************************************--> + + -Line Input # Statement [Runtime] +Line Input # Statement [Runtime] /text/sbasic/shared/03020203.xhp Sun Microsystems, Inc. -converted from old format - fpe +converted from old format - fpe - - -
- Line;functionLine Input # Statement [Runtime] - Reads strings from a sequential file into a variable. -
- Syntax: - Line Input #FileNumber As Integer, Var As String - Parameters: - FileNumber: Number of the file that contains the data that you want to read. The file must have been opened in advance with the Open statement using the key word READ. - var: The name of the variable that stores the result. - With the Line Input# statement, you can read strings from an open file into a variable. String variables are read line-by-line up to the first carriage return (Asc=13) or linefeed (Asc=10). Line end marks are not included in the resulting string. - Example: - Sub ExampleWorkWithAFile - Dim iNumber As Integer - Dim sLine As String - Dim aFile As String - Dim sMsg as String - aFile = "c:\data.txt" - - iNumber = Freefile - Open aFile For Output As #iNumber - Print #iNumber, "This is a line of text" - Print #iNumber, "This is another line of text" - Close #iNumber - - iNumber = Freefile - Open aFile For Input As iNumber - While not eof(iNumber) - Line Input #iNumber, sLine - If sLine <>"" then - sMsg = sMsg & sLine & chr(13) - end if - wend - Close #iNumber - Msgbox sMsg - End Sub - - +
+Line function + +Line Input # Statement [Runtime] +Reads strings from a sequential file into a variable. +
+Syntax: +Line Input #FileNumber As Integer, Var As String +Parameters: + +FileNumber: Number of the file that contains the data that you want to read. The file must have been opened in advance with the Open statement using the key word READ. + +var: The name of the variable that stores the result. +With the Line Input# statement, you can read strings from an open file into a variable. String variables are read line-by-line up to the first carriage return (Asc=13) or linefeed (Asc=10). Line end marks are not included in the resulting string. +Example: +Sub ExampleWorkWithAFile +Dim iNumber As Integer +Dim sLine As String +Dim aFile As String +Dim sMsg as String +aFile = "c:\data.txt" +iNumber = Freefile +Open aFile For Output As #iNumber +Print #iNumber, "This is a line of text" +Print #iNumber, "This is another line of text" +Close #iNumber +iNumber = Freefile +Open aFile For Input As iNumber +While not eof(iNumber) +Line Input #iNumber, sLine +If sLine <>"" then +sMsg = sMsg & sLine & chr(13) +end if +wend +Close #iNumber +Msgbox sMsg +End Sub +
diff --git a/helpcontent2/source/text/sbasic/shared/03020204.xhp b/helpcontent2/source/text/sbasic/shared/03020204.xhp index 4ef0a0efff..3fc9226de8 100755 --- a/helpcontent2/source/text/sbasic/shared/03020204.xhp +++ b/helpcontent2/source/text/sbasic/shared/03020204.xhp @@ -52,63 +52,64 @@ * Contributor(s): _______________________________________ * * - ************************************************************************--> + ************************************************************************--> + + -Put Statement [Runtime] +Put Statement [Runtime] /text/sbasic/shared/03020204.xhp Sun Microsystems, Inc. -converted from old format - fpe +converted from old format - fpe - - -
- Put;functionPut Statement [Runtime] - 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 REM 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 REM Position to start writing - Put #iNumber,, "This is the first line of text" REM 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 - - +
+Put statement + +Put Statement [Runtime] +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 REM 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 REM Position to start writing +Put #iNumber,, "This is the first line of text" REM 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 +
diff --git a/helpcontent2/source/text/sbasic/shared/03020205.xhp b/helpcontent2/source/text/sbasic/shared/03020205.xhp index 213f86f57f..734bfa62ce 100755 --- a/helpcontent2/source/text/sbasic/shared/03020205.xhp +++ b/helpcontent2/source/text/sbasic/shared/03020205.xhp @@ -52,46 +52,49 @@ * Contributor(s): _______________________________________ * * - ************************************************************************--> + ************************************************************************--> + + -Write Statement [Runtime] +Write Statement [Runtime] /text/sbasic/shared/03020205.xhp Sun Microsystems, Inc. -converted from old format - fpe +converted from old format - fpe - - -
- Write;functionWrite Statement [Runtime] - Writes data to a sequential file. -
- Syntax: - Write [#]FileName, [Expressionlist] - Parameters: - FileName: Any numeric expression that contains the file number that was set by the Open statement for the respective file. - Expressionlist: Variables or expressions that you want to enter in a file, separated by commas. - If the expression list is omitted, the Write# statement appends an empty line to the file. - To add an expression list to a new or an existing file, the file must be opened in the Output or Append mode. - The Write# statement enters data that is enclosed by quotation marks and separated by commas into a file. You do not need to use delimiters in the list. The end of a file created with the Write# statement is indicated by a line end symbol. - Example: - Sub ExampleWrite - Dim iCount As Integer - Dim sValue As String - iCount = Freefile - open "C:\data.txt" for OutPut as iCount - sValue = "Hamburg" - Write #iCount,sValue,200 - sValue = "New York" - Write #iCount,sValue,300 - sValue = "Miami" - Write #iCount,sValue,450 - close #iCount - end sub - - +
+Write function + +Write Statement [Runtime] +Writes data to a sequential file. +
+Syntax: +Write [#]FileName, [Expressionlist] +Parameters: + +FileName: Any numeric expression that contains the file number that was set by the Open statement for the respective file. + +Expressionlist: Variables or expressions that you want to enter in a file, separated by commas. +If the expression list is omitted, the Write# statement appends an empty line to the file. +To add an expression list to a new or an existing file, the file must be opened in the Output or Append mode. +The Write# statement enters data that is enclosed by quotation marks and separated by commas into a file. You do not need to use delimiters in the list. The end of a file created with the Write# statement is indicated by a line end symbol. +Example: +Sub ExampleWrite +Dim iCount As Integer +Dim sValue As String +iCount = Freefile +open "C:\data.txt" for OutPut as iCount +sValue = "Hamburg" +Write #iCount,sValue,200 +sValue = "New York" +Write #iCount,sValue,300 +sValue = "Miami" +Write #iCount,sValue,450 +close #iCount +end sub +
diff --git a/helpcontent2/source/text/sbasic/shared/03020301.xhp b/helpcontent2/source/text/sbasic/shared/03020301.xhp index ee4921ca87..81d85b9879 100755 --- a/helpcontent2/source/text/sbasic/shared/03020301.xhp +++ b/helpcontent2/source/text/sbasic/shared/03020301.xhp @@ -52,59 +52,59 @@ * Contributor(s): _______________________________________ * * - ************************************************************************--> + ************************************************************************--> + + -Eof Function [Runtime] +Eof Function [Runtime] /text/sbasic/shared/03020301.xhp Sun Microsystems, Inc. -converted from old format - fpe +converted from old format - fpe - - -
- Eof; functionEof Function [Runtime] - Determines if the file pointer has reached the end of a file. -
- Syntax: - Eof (intexpression As Integer) - Return value: - Bool - Parameters: - Intexpression: Any integer expression that evaluates to the number of an open file. - Use EOF to avoid errors when you attempt to get input past the end of a file. When you use the Input or Get statement to read from a file, the file pointer is advanced by the number of bytes read. When the end of a file is reached, EOF returns the value "True" (-1). - - - - Example: - Sub ExampleWorkWithAFile - Dim iNumber As Integer - Dim sLine As String - Dim aFile As String - Dim sMsg as String - aFile = "c:\data.txt" - - iNumber = Freefile - Open aFile For Output As #iNumber - Print #iNumber, "First line of text" - Print #iNumber, "Another line of text" - Close #iNumber - - iNumber = Freefile - Open aFile For Input As iNumber - While not eof(iNumber) - Line Input #iNumber, sLine - If sLine <>"" then - sMsg = sMsg & sLine & chr(13) - end if - wend - Close #iNumber - Msgbox sMsg - End Sub - - +
+Eof function + +Eof Function [Runtime] +Determines if the file pointer has reached the end of a file. +
+Syntax: +Eof (intexpression As Integer) +Return value: +Bool +Parameters: + +Intexpression: Any integer expression that evaluates to the number of an open file. +Use EOF to avoid errors when you attempt to get input past the end of a file. When you use the Input or Get statement to read from a file, the file pointer is advanced by the number of bytes read. When the end of a file is reached, EOF returns the value "True" (-1). + + + +Example: +Sub ExampleWorkWithAFile +Dim iNumber As Integer +Dim sLine As String +Dim aFile As String +Dim sMsg as String +aFile = "c:\data.txt" +iNumber = Freefile +Open aFile For Output As #iNumber +Print #iNumber, "First line of text" +Print #iNumber, "Another line of text" +Close #iNumber +iNumber = Freefile +Open aFile For Input As iNumber +While not eof(iNumber) +Line Input #iNumber, sLine +If sLine <>"" then +sMsg = sMsg & sLine & chr(13) +end if +wend +Close #iNumber +Msgbox sMsg +End Sub +
diff --git a/helpcontent2/source/text/sbasic/shared/03020302.xhp b/helpcontent2/source/text/sbasic/shared/03020302.xhp index 731b329d90..83252036ac 100755 --- a/helpcontent2/source/text/sbasic/shared/03020302.xhp +++ b/helpcontent2/source/text/sbasic/shared/03020302.xhp @@ -52,34 +52,37 @@ * Contributor(s): _______________________________________ * * - ************************************************************************--> + ************************************************************************--> + + -Loc Function [Runtime] +Loc Function [Runtime] /text/sbasic/shared/03020302.xhp Sun Microsystems, Inc. -converted from old format - fpe +converted from old format - fpe - - -
- Loc;functionLoc Function [Runtime] - Returns the current position in an open file. -
- Syntax: - Loc (FileNumber) - Return value: - Long - Parameters: - FileNumber: Any numeric expression that contains the file number that is set by the Open statement for the respective file. - If the Loc function is used for an open random access file, it returns the number of the last record that was last read or written. - For a sequential file, the Loc function returns the position in a file divided by 128. For binary files, the position of the last read or written byte is returned. - - - - +
+Loc function + +Loc Function [Runtime] +Returns the current position in an open file. +
+Syntax: +Loc(FileNumber) +Return value: +Long +Parameters: + +FileNumber: Any numeric expression that contains the file number that is set by the Open statement for the respective file. +If the Loc function is used for an open random access file, it returns the number of the last record that was last read or written. +For a sequential file, the Loc function returns the position in a file divided by 128. For binary files, the position of the last read or written byte is returned. + + + +