This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.
This version is copyright and may only be used for local testing purposes. It may not be distributed.
Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.
Description
Read a data record from a file open AS RANDOM
Syntax
s = FILE_GETR(FileID, nRec, UDTStructure)
Returns
Return a string containing the same data that will be filled into UDTStructure.
Parameters
Name |
Type |
Optional |
Meaning |
FileID |
Number |
No |
A previously open random access file handle |
nRec |
Number |
No |
Record number to be retrieved |
UDTStructre |
UDT |
No |
Any UDT data structure. Use the same UDT to GET data from and PUT into a random access file. This UDT structure will receive retrieved data |
Remarks
Restrictions
See also
Examples
Thanks to Psch for the following script example
USES "File", "Console"
Type tRecord
LName As String * 12
FName As String * 8
Age As Byte
End Type
Dim Item As tRecord
Dim OutFileName As String = app_sourcepath & "Test.DAT"
Dim f As DWORD
file_KILL(OutFileName)
f = file_Open(OutFileName, "random", SIZEOF(tRecord))
PRINTL "Vader in the file"
Item.LName = "Vader"
Item.FName = "Darth"
Item.Age = 40
file_putr(f, 1, Item)
PRINTL "Yoda in the file"
Item.LName = "Yoda"
Item.FName = "Mister"
Item.Age = 45
file_putr(f, 2, Item)
PRINTL "---------------------------"
PRINTL "Seeking first: "
file_getr(f, 1, Item)
PRINTL item.LName, item.FName, item.Age
PRINTL "Seeking second: "
file_getr(f, 2, Item)
PRINTL item.LName, item.FName, item.Age
file_Close(f)
WAITKEY