LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Edit txt file

Solved!
Go to solution

In C# in order to edit a line in a file i have to do as following:

1. Read content in a string array.

2. Find a line in the array I want to edit.

3. Edit the line.

4. Write updated string array into the file.

I wonder if  I have to do the same in LabView?

0 Kudos
Message 1 of 7
(3,992 Views)

Hi,

with Labview, you can write a part of a file by using cursors.
Have a nice day,

V-F
0 Kudos
Message 2 of 7
(3,989 Views)
Solution
Accepted by john7

Try this example: https://decibel.ni.com/content/docs/DOC-25163


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
Message 3 of 7
(3,979 Views)

Hi ramses64,

Can you be more specific about it? What is "cursors"  and how we use it?

0 Kudos
Message 4 of 7
(3,978 Views)

As an aside, in why are you reading the whole file into an array? Why not use file.readline() and file.writeline()?

_____________________________
- Cheers, Ed
0 Kudos
Message 5 of 7
(3,969 Views)

As far as i know you can not edit a line in the middle of the file. Have to read the whole file with file.readline() any way.

0 Kudos
Message 6 of 7
(3,960 Views)

You can edit parts of a file without reading the entire file. However, you can only change the characters in the file; you cannot insert new characters in the middle or delete existing characters without reading and rewriting everything past the point where you are making changes. To go to a specific location in a file, use the Set File Position function in the File IO->Advanced File Functions palette. The next read or write will start at that file position, so to make changes in the middle of a file you need only to move to the right file position and start writing, which will overwrite the existing data from that location.

Message 7 of 7
(3,940 Views)