by Paul Spiteri (3 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (9 Votes)
This code is a very quick way of getting data from a file.
Inputs
RAFSearch, used to get data returns the MyData variable type.
You need to pass a parameter for the ID to find.
RAFAdd needs to be passed the ID of the new record, and as it currently stands, the Name and Password of the 'user' being added. This will need to be changed to suit you.
Assumes
None.
Code Returns
RAFSearch returns the MyData variable type.
Therefore you should do:
Dim TempData as MyData
TempData = RAFSearch(50)
TempData will now have the data for ID 50.
If TempData.ID = -1, the record does not exist.
RAFAdd returns a boolean. True if it was added successfully, false if it was not - probably a full file, increase the MaxRecords variable and start again.
Side Effects
The MaxRecords can only be changed once, when the RAFClear is executed, which clears and sets up the pointer file.
API DeclarationsNone.
Download A User Account File System. Fast Find, Fast Add (3 KB)