Bookshelf Home | Contents | Index | PDF |
Siebel VB Language Reference > VB Language Reference > Get StatementThis standard VB function reads data from a file opened in Random or Binary mode and puts it in a variable. SyntaxGet [#]filenumber, [recnumber], varName ReturnsUsageFor more information about how files are numbered when they are opened, read Open Statement. The Recnumber argument is in the range 1 to 2,147,483,647. If this argument is omitted, the next record or byte is read. NOTE: The commas before and after the recnumber are required, even if you do not supply a recnumber. For Random mode, the following rules apply: Blocks of data are read from the file in chunks whose size is equal to the size specified in the Len clause of the Open statement. If the size of varName is smaller than the record length, the additional data is discarded. If the size of varName is larger than the record length, an error occurs. For variable length string variables, Get reads two bytes of data that indicate the length of the string, then reads the data into varName. For variant variables, Get reads two bytes of data that indicate the type of the variant, then it reads the body of the variant into varName. Note that variants containing strings contain two bytes of data type information followed by two bytes of length followed by the body of the string. User defined types are read as if each member were read separately, except no padding occurs between elements. Files opened in Binary mode behave similarly to those opened in Random mode, except that:
ExampleThis example opens a file for Random access, gets its contents, and closes the file again. The second subprogram, (general) (declarations) Sub CreateFile Sub Button1_Click See Also |
Siebel VB Language Reference |