Jacob Thastrup wrote:
> Hi
>
> I have a lot of data files of different sizes in the last few lines are
> a description of the file. Is there a way to read a file backwards so
> that I don't have to read the whole file just to use the last few lines?
There will be a straightforward solution if the file description section is
always a fixed length, or if there is a fixed upper limit on the length and
some clear way to identify where the description begins.
- If the description section is a fixed length N (number of bytes):
1. Use the File/Directory Info VI from the File>>Advanced palette to get
the overall size of your file, F
2. Use the Read File VI, specify an offset of (F-N)+1 and a count of N, and
you've got your info section
- If the description section is not
fixed in size, but will never be longer
than L bytes:
1. Do the same thing as above, using L as your description length
2. Use the Match Pattern VI (String palette) with whatever identifier
begins your description section to parse out just the description
Regards,
John Lum