I'm writing a program that needs to randomly access a text file. All the books I've read have not been helpful.
Right now the user enters a label code and I search the file sequentially for a match. Because I'm using text files (binary files are not possible - the files are created in a BBx environment) I'm using fscanf and fprintf to read and write to the file. I'd like to use a random search for the label code to speed things up. As far as I have read I can't use fread & fwrite with text files. My biggest problem is that I can't find an example of a random search that doesn't use the record number. I need to search by the label code not the position of the record in the file.
Any tips/help or book references would be appreciated. Thanks in advance.
Heather
Right now the user enters a label code and I search the file sequentially for a match. Because I'm using text files (binary files are not possible - the files are created in a BBx environment) I'm using fscanf and fprintf to read and write to the file. I'd like to use a random search for the label code to speed things up. As far as I have read I can't use fread & fwrite with text files. My biggest problem is that I can't find an example of a random search that doesn't use the record number. I need to search by the label code not the position of the record in the file.
Any tips/help or book references would be appreciated. Thanks in advance.
Heather