LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[Beginner] Labview 2010 : Vi "Write to text file" overwrite existing file instead of appending new data

Solved!
Go to solution

Hello

 

I want to write data into a texte file. Don't ask me why, I have to use the vi "Write to text file" and not "Write to a Measurement file". Everybody do that in my office.

The point is that when I use this vi,  the file is always overwritten though I want to append data into the same file. See attachement for a view of my program. Obviouly, I try to find some option in the property but none.. I sent out the vi outside the lopp but it doesn't work

Weirdly, it works fine with Labview 2009 but not Labview 2010

 

Anybody have an idea ?

 

Thanks for all

 

0 Kudos
Message 1 of 8
(12,768 Views)

This is straight from the help file for Write text file....

"To append to an existing file, set the file position to the end of the file by using the Set File Positoin function"

 

To look into the code working in one version of LabVIEW and not another, it would help if you posted your vi, not just a jpg.

 

Ian

Message 2 of 8
(12,765 Views)

 


_Ian_ wrote :

This is straight from the help file for Write text file....

"To append to an existing file, set the file position to the end of the file by using the Set File Positoin function"

 


Well I don't see that in the help file. I must say anyway that I using the French edition of Labview and it possible it's missing some things. can you tell me more because I dont catch what you meant.

 

My VI is attached

 

Thanks for all

0 Kudos
Message 3 of 8
(12,756 Views)
Solution
Accepted by topic author Amethyste

See the attached - open the file, move to the end, write the text, close the file.

You can also write to the start of the file or to positions in the middle.

 

Ian

Message 4 of 8
(12,745 Views)

I think you need to use a refnum. I used "detailed help" from the icon on your VI and this is what it said ablout "FILE" This is in LV 10.0

 

file can be a refnum or absolute file path. If you wire a path to the file input, the function opens or creates the file before writing to it and replaces any previous file contents. If you wire a file refnum to the file input, writing begins at the current file position. To append to an existing file, set the file position to the end of the file by using the Set File Position function. The default is to display a file dialog box and prompt you to select a file.

 

Alan

0 Kudos
Message 5 of 8
(12,744 Views)
Thanks a lot for your help. Ian solved my problem. S orry Alan but Firefox can't open your file Many thanks anyway
0 Kudos
Message 6 of 8
(12,714 Views)

I know you closed this topic I just wanted to clear up the "Fire Fox" issue. And at the same time maybe give you another way to look at the problem. The link was actually part of LabVIEW help. If you open the "show context help"  window and curser over the "write to text file" ICON in your VI , then click the "show detailed help" in the window, you will see what I posted and you can then click on that link. (it's not a web link).

Any way glad your issue is solved.

 

Alan

0 Kudos
Message 7 of 8
(12,702 Views)
Thanks Alan I obviously read the detailled help so as to try to solve the problem myself. The point is my Labview edition is French and seemingly the French help is not as complete as the English one... That's really a pity but I have to do with it. Thanks for all Antoine
0 Kudos
Message 8 of 8
(12,674 Views)