From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write to file without over write current data?

The option write characters to file is not available as I can see. The alternative is format into string and write text/ write file. I tried different option but I have no success with getting newline after every line written to file. I only do overwrite existing data. Possibly it is my design which are messing thing up (I have a number of structures). Advices  will be very helpsome.
 
A
0 Kudos
Message 1 of 3
(2,201 Views)
Hi A123,

uh-oh - what a mess!

Please:
- remove from your vi all unneeded structures, I only left them in to show alternative ways of solving your problems!
- never ever make a sequence (here even worse a stacked one) with 15 frames!
- whenever you need a part of your diagram more than once: make a subvi from it: when you test the individual bits you only have to give bitnumber and result string as parameter for a subvi!
- when you test just one bit after the other a loop structure will greatly reduce overhead: FOR i=15 to 31 do Test_Bit_vi!
- open a file only once outside the main loop/sequence and do only set file position and write operations inside the structure!
- starting from frame 2 you forgot to set the fileposition to the end!

Even more comments/ideas:
You convert the whole string again and again for each bit you want to test. Why not convert only once and test all bits in parallel? I already gave you a vi which reads in the whole string and converts it to arrays of numbers...

And please:
Stick with your original thread, so others may have an insight how your vi became what is now!

Best regards,
Gerd
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(2,188 Views)
Please see the context help for Write to Text File (attached file). It's explains how you can add characters to an existing file. I have also added an example and a screen shot of it.
 
I don't want add more comments to your programming style but you should really follow GerdW's recommendations !
0 Kudos
Message 3 of 3
(2,183 Views)