Hi all,
I have a text file that contains several lines of data (text). Now I would like to replace the first three lines with text coming from a string array.
My approach is shown in WriteToFile.vi that is attached.
When I am executing this vi (with an empty file), everything seems to be working fine in the first place.
The file will contain the following text:
oneoneone
twotwotwo
threethreethree
Now, when the third element in the array is shortened (lets say to "threethr") before execution, the file will contain the following text:
(the file was not emptied before execution)
oneoneone
twotwotwo
threethr
threeHow can I avoid the last line being written? I have made many tests and I could not find a solution.
One more example:
Lets say we have an existing file, inside this file is:
oneoneone
twotwotwo
three
fourfourfour
Now I would like to overwrite line three with "threethreethree". Therefore I execute my vi as shown in the attachment.
What I get as a result is:
oneoneone
twotwotwo
threethreethree
ur
So, the text in line four, which should not be touched, is "ur" instead of "fourfourfour".
Any idea to solve this problem?
What I basically need is replacing a line of a text file in a conveinient way.
Thanks,
Holger
----
LV 8.5.1