取消
显示结果 
搜索替代 
您的意思是: 

Edit txt file

已解决!
转到解答

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 项奖励
1 条消息(共 7 条)
4,746 次查看

Hi,

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

V-F
0 项奖励
2 条消息(共 7 条)
4,743 次查看
解答
已被主题作者 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
3 条消息(共 7 条)
4,733 次查看

Hi ramses64,

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

0 项奖励
4 条消息(共 7 条)
4,732 次查看

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 项奖励
5 条消息(共 7 条)
4,723 次查看

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 项奖励
6 条消息(共 7 条)
4,714 次查看

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.

7 条消息(共 7 条)
4,694 次查看