06-28-2021 04:38 PM - edited 06-28-2021 04:40 PM
Hi Reduanul,
@REDUANUL wrote:
But want to append new data to an already existing file by "deleting" the old content and only write the new data to the existing file.
So this is what your code should do - and actually is doing!
By "replace or create" you are "deleting the old content" of the file and then you "only write the new data" into the "existing file"…
(As has been said before you don't need to "set to end of file" after recreating the file.)
06-28-2021 08:12 PM
@REDUANUL wrote:
Hello GerdW,
Here is my explanation:
I have created a file as of now. But want to append new data to an already existing file by "deleting" the old content and only write the new data to the existing file.
I hope now it's clear.
Sorry, but that is not clear and does not make sense.
If you delete the old content, then you can't append because there is now nothing to append to! Append means to put something at the end of something that already exists!
06-28-2021 10:10 PM
please enlighten us with how the file content looks like before and after your said "append" operation?
06-29-2021 09:38 AM
Hello RavensFan and Santo,
Well, let me try again to explain my problem:
The problem is I am trying to save XY graph data in a .txt file. So when the first time I save my data, everything is fine, and a new file has been created. Later on, when I am saving again, new data is being saved (replacing the file) with old data. I want each time only new data will be saved, so there should not be old data.
Now here is my code:
Here whatever is happening after saving my data:
Thanks for your time.
06-29-2021 09:44 AM
I downloaded your VI snippet and dropped it into a blank VI.
I had to change the browse options for the application directory so that it would select folders. Right now it is set for files. (Though that might be an artifact of the snippet making and dropping process.)
I ran your VI. Once with one string, and again with anotherl
It DOES NOT do what you describe. After the first run, it only had the first string. After the second run, it only had the second string.
You must have something going on in code besides what you have presented in this last e-mail.
06-29-2021 11:49 AM
RavensFan got the problem.
You were right. "You must have something going on in code".
Now everything is solved by adding an empty string (in my code) for each saving operation. Now only new data remains, and while loading, it's plotting with new data instead of old data and new data.
Appreciate your effort and suggestions 🙂