LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to change only a part of file ".txt"

hello!I had to do an industrial project and i had to create a file ".txt" in order to list words(for exemple) and I want know how I can delete just one word anywhere in this file.Thak you for your answer.
0 Kudos
Message 1 of 2
(2,457 Views)
Hi mikael

A text file is just one long string of bytes stored on the hard disk. When you read a text file in labview it will it imported as a long array of characters.

What I suggest you do is read the whole file in then use Search 1D array.vi to find the location of the word you are looking for. The outputs of this vi are String before, string after and offset point. Used concatinate strings.vi to append the after string to the before sting and hay presto you now have a sting minus the word you wanted to remove.

All thats left is to resave the new sting over the old one.

Hope this helps

Philip McDermott
0 Kudos
Message 2 of 2
(2,457 Views)