LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting first line off file

Hello,

I want to remove the first line of a file. Is there any way to do that without reading the whole file and putting it in a huge string?

Something like setting the "begining of file marker" (does that exist?). I've looked in the "advanced file function" and can't find a way to do it.

Any suggestion?

Thanks a lot!!

Vincent
Message 1 of 5
(2,993 Views)
You can use the Read File by Lines (Right Click on the Read File VI), set the count to -1 to read the entire file, delete the first array element. Then write the new array back.
Andrew Alford
Production Test Engineering Technologist
Sustainable Energy Technologies
www.sustainableenergy.com
0 Kudos
Message 2 of 5
(2,986 Views)
I don't see any Read File by Lines vi in LV7.1.  Maybe it exists in LV 8.  However there is a Read Lines from File vi but it does not produce an array of lines (at least not in LV 7.1).  You can use the Read Lines from File vi and set the number of lines to 1.  The output mark after read is now set to point to the second line.  You can use this as an input to start of read offset on your next read call.  This vi will open the file, read, then close the file.  Calling it a second time will open the file again, read, then close again.
 
Another way is to open the file using Open/Create/Replace File.  Then use Read File and set the Line Mode input to True.  This will read the first line.  A second Read File call will then begin reading at the second line without having to wire any offsets.  After reading all that you want, you close the file.  One open, several reads, one close.  This is more efficient.
 

Message Edited by tbob on 03-06-2007 03:03 PM

- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 5
(2,978 Views)

You are correct in LV8.2 Read file is polymorphic. How ever in LV 7.1.1 the Read Lines from file is under the File IO menu in the functions pallet. See below:

 

 

Message Edited by AndrewAlford on 03-06-2007 03:35 PM

Andrew Alford
Production Test Engineering Technologist
Sustainable Energy Technologies
www.sustainableenergy.com
0 Kudos
Message 4 of 5
(2,971 Views)
I sure wish my company would upgrade.  So many new things to take advantage of.
- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 5
(2,965 Views)