EJW Posted August 31, 2006 Report Share Posted August 31, 2006 I have been looking for a way to use random access files in labview. The closest thing i have seen is the datalog files, which are not completely what i am looking for. The datalog files can randomly read, but they only append to the end of the file. What i need is a way to read/write randomly to a specific location/record in a file. If i want to update record 15 with new information, i don't want to have to rewrite the whole file!! Any help is greatly appreciated. Eric Quote Link to comment
LAVA 1.0 Content Posted August 31, 2006 Report Share Posted August 31, 2006 Look in the Advanced File Functions pallete, you should see "Seek". Pass in your file refnum along with your position before performing a write, using the same refnum. To avoid race conditions, be sure to wire the Seek refnum out and error out cluster from Seek to the Write... (I'm at home today, and I'm not sure if the primatives for the file I/O palletes have changed with 8.0 / 8.20.) Quote Link to comment
EJW Posted August 31, 2006 Author Report Share Posted August 31, 2006 Look in the Advanced File Functions pallete, you should see "Seek". Pass in your file refnum along with your position before performing a write, using the same refnum. To avoid race conditions, be sure to wire the Seek refnum out and error out cluster from Seek to the Write... (I'm at home today, and I'm not sure if the primatives for the file I/O palletes have changed with 8.0 / 8.20.) Look in the Advanced File Functions pallete, you should see "Seek". Pass in your file refnum along with your position before performing a write, using the same refnum. To avoid race conditions, be sure to wire the Seek refnum out and error out cluster from Seek to the Write... (I'm at home today, and I'm not sure if the primatives for the file I/O palletes have changed with 8.0 / 8.20.) I tried that in Labview 7.1 and it does not seem to work with records. (Its says it does.) I am trying to do this in 8.0.1 which says the offset is in bytes only ( i guess i could try records, but i doubt it works). BTW, in Labview 8, SEEK has been changed to SET FILE POSITION. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.