From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

insert in text file

Solved!
Go to solution

Am I correct in interpreting that you're simply trying to insert a header row? You stated that you need to "insert text at the second line, after "Liste de lecture :", but I don't really know in advance the lenght of the string I have to insert." This implies that you want to insert the header row:

Son	Image	subj_mes1	subj_mes2	physio_GSR	physio_PPG	physio_EMG	physio_EEG G	physio_EEG D

I'm just trying to understand what's going on here and what you're working with since it sounds like we're only getting part of the whole story. Are you trying to back-edit files that have already been created? If not, you should already know how many columns and what they are while you save your measurements, so I don't see why you need to be doing any kind of inserting in this case. You should be writing out the header before you write out the data.

 

0 Kudos
Message 11 of 13
(921 Views)

studiobods wrote:

Moreover, for better readability of the file, ...


"better readability" and 800MB are not heard together very often. 😮

 

Since you knoew exactly after which string you want to insert the new data, you could for example leave some blank space (of sufficient size). When you write that "Liste de lecture " write "Liste de lecture +X spaces+ a delimiter" for the first time and even mark the file position and write it in some hader at the beginning of the file.

 

Later you can simply read the offset from early in the file and overwrite the blanks reserved earlier.

0 Kudos
Message 12 of 13
(914 Views)

altenbach a écrit:

studiobods wrote:

Moreover, for better readability of the file, ...


"better readability" and 800MB are not heard together very often. 😮

 

Since you knoew exactly after which string you want to insert the new data, you could for example leave some blank space (of sufficient size). When you write that "Liste de lecture " write "Liste de lecture +X spaces+ a delimiter" for the first time and even mark the file position and write it in some hader at the beginning of the file.

 

Later you can simply read the offset from early in the file and overwrite the blanks reserved earlier.


That is what I do like I describe it in my last reply. Thanks a lot for your comments. 

 



Matthias Baudot | Software Architect | Founder at STUDIO BODs


STUDIO BODs     BLT for LabVIEW     LabVIEW Champion     Certified Professional Instructor     DQMH Trusted Advisor     GCentral Sponsor


 Check out my LabVIEW presentations and videos!

0 Kudos
Message 13 of 13
(909 Views)