From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting line of text

I want to insert a line of text or multiple lines of text into an existing text file.

I don't want to convert the existing text file into an array etc.

would somebody be able to show me an example of that?

 

I will attach an example of the text file

0 Kudos
Message 1 of 3
(413 Views)

A file is basically just a long string, so unless you append your new lines to the end, many bytes need to rewritten.

The concept of "lines" is just the presence of a special delimiter, e.g. a linefeed.

 

For anything else, easiest would be to read the entire file as a string, modify it, and write it back to the file. This does not need to have anything to do with arrays.

 

Please show us your code and explain whet you want to insert and where.

0 Kudos
Message 2 of 3
(372 Views)

Well once again you solved my problem just by simply stating the basic idea in which a text file is simply a continuous string of characters.

Thank you for the excellent help!

Chris

0 Kudos
Message 3 of 3
(309 Views)