LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

insert a line into the beginning of a file without overwriting data

I would like to dynamically alter/add new headers to a csv file as needed. The code I have below overwrites the previously written data an amount equal to each new header added each time I call the vi below. Any suggestions on how to do this without reading in the file each time? I want to avoid the processing time of reading in the file between processing new data.

Thanks!

 

 

insert headers2.pnginsert headers.png

0 Kudos
Message 1 of 6
(3,295 Views)

The simple answer is No.

You need to read the entire file to pre-pend that line.

 

If you were actually working with true Excel files, you can.

0 Kudos
Message 2 of 6
(3,287 Views)

Thanks! That's what I thought.

0 Kudos
Message 3 of 6
(3,262 Views)

If you're gonna change the file several time during a run you can ofc. keep the data/file in memory and modify that instead.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 6
(3,253 Views)

The problem with that is for days of testing you might loose data if something goes wrong.

0 Kudos
Message 5 of 6
(3,233 Views)

Yes, but you can still write everytime, you dont need to read the file back. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 6
(3,224 Views)