LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

appending data to the same text file

Hi all
I am writing some data for an operation that is excuted a number of times using a  while loop , each time I write the results to a text file, what I want that all the loops results to be appened to the same file but it doesnt it over writes on  each result of the loop on the same file , I am opening the file outside the loop writing inside the loop and closing the file outside the loop, how can I make my VI appened  all the data of the loops for the same file
thnaks alot
 
0 Kudos
Message 1 of 17
(3,525 Views)
Hi maple,

which LV version do you use?

Upto LV71 you have to connect a constant to the 'append?' input of the 'write chars to file' to have the text appended.

From LV80 you have to use 'Set file position' (0 bytes from end) before writing.

P.S.: I dislike the new file vi's. There should be at least a palette containing the old file functions...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 17
(3,522 Views)

Hi

Thanks for you help , I am using LV8 , so I need to put set file postion before I write each time right? what is this VI and how does it work and what should I conect to it

thnaks alot

0 Kudos
Message 3 of 17
(3,521 Views)
Hi maple,

it's pretty straightforward: it sets the position of the next read/write access in the file. If you want to append data you have to set the position at the end of the file...
The help for the vi is rather ok 🙂

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 17
(3,511 Views)
Hello!
 
Here's one way you might use it:
 
 
Hope this helps,

Message Edited by Charlie S. on 08-11-2006 11:50 AM

Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
Message 5 of 17
(3,492 Views)

Thanks all

it worked

Maple72Smiley Happy

0 Kudos
Message 6 of 17
(3,474 Views)
Hi charlie
this worked but , it asks me each loop where to append the data , cant I make it appened automatically to the same file I choose at the begining
Thanks
0 Kudos
Message 7 of 17
(3,425 Views)
Hi maple,

it seems 'Set file position' or the following 'write' does not get the correct file name/handle. Is the wiring of the file handle correct?
For faster/more precise help you better attach your vi (or a picture - but no BMP!).

Message Edited by GerdW on 08-18-2006 09:27 AM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 17
(3,414 Views)

Hi gerdW

attched is my program , thnaks for your help

Maple

0 Kudos
Message 9 of 17
(3,400 Views)
Hi maple,

in your picture (btw. *.doc is also not perfect, not everybody uses/likes MS-Office due to possible virus problems) you only show the part of file opening and setting file position. You don't show the file write/read operations... Can't you attach the vi itself?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 17
(3,362 Views)