From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Appending text to a file query

Hi there!
 
I'm trying to do the following. I create a filename then check if it exists, if it does, then i open it and set the file position to the end of the file. I then call a for loop which should write some values to it. However, if the file does not exist, i create it and set the file position to the end of the file and then add some header information to the file.
 
The problem is, that the file gets rewritten on each write!
 
Please advise.
Thanks.
Regards,
Download All
0 Kudos
Message 1 of 8
(2,794 Views)

Matrix,

If you delete the offset constant, the VI should work fine. If you look at the help of file position vi, you will see that the offset in bytes actually sets the file marker. if it is an existing file, you do not want to change this ever assuming your appending)

 

Chris Co

0 Kudos
Message 2 of 8
(2,785 Views)

Hi there!

Thanks for your reply. I removed the constant for the offset in the case where the file does exist. However, it still does not work!

Thanks.

Regards,

 

0 Kudos
Message 3 of 8
(2,781 Views)

Matrix,

It does work, it just doesnot appear to work because of the way you are writing the file.  Put an end of line constant at the end of the concenate string and run twice.

Chris Co

0 Kudos
Message 4 of 8
(2,772 Views)
0 Kudos
Message 5 of 8
(2,771 Views)

Hey there!

 

I added the end of line character to it, but doesnt seem to be working, what am i doing wrong? Furthermore, i cant open the file 'cos i have labview 8.0 and not 8.2.

Thanks.

Regards,

0 Kudos
Message 6 of 8
(2,755 Views)

Here, i saved to version 8.0. I replaced your space constant with a tab so it opens easily in excel. 

Chris Co

0 Kudos
Message 7 of 8
(2,745 Views)

Hey again!

Thanks so much for the advice to get it to work.. Much appreciated 🙂

Regards,

 

 

0 Kudos
Message 8 of 8
(2,740 Views)