LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

scanfile backward

have a file where I would like to jump to different lines (label jumps). For this I use the "Set File Pointer" command to jump to the beginning of the file. I use the "Scanfile" command to look for the corresponding line. Sometimes this file is very extensively, which partly lasts for a very long search. Is there a possibility of searching the file from the present position backward, because the searched line is always some lines above the present position. It is not possible to use an offset for scanning, because the distance to the corresponding line is variable.
0 Kudos
Message 1 of 2
(2,606 Views)
If your data file has fixed length records, you can use SetFilePtr to move backward a record at a time (based on the known record length) and then use ScanFile to read the record.
If your data is all numeric, you already have a fixed record length. If you have string data, you may need to pad the strings to get the fixed length records.
Message 2 of 2
(2,606 Views)