LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Read a file between two lines

Solved!
Go to solution

Hello,
Can you tell me if, thank's to a function, we can read between two lines ?
For example, I have one file in.txt, it has 10 lines, and, I want to write what we have between lines 4 and 8 in an other file out.txt.  
Thank's for your time

0 Kudos
Message 1 of 5
(2,957 Views)
Solution
Accepted by topic author Zerged

There isn't a native function that performs what you want but you can easily write one by yourself.

Something like this (pseudocode):

Open file for input (OpenFile)
Open file for output (OpenFile)

Read all lines one-by-one (ReadLine)
  Copy desired lines to oputput file (WriteLine)

Close input file (CloseFile)
Close output file (CloseFile)

Do not forget to add a proper error checking strategy to deal with I/O errors.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 5
(2,947 Views)
Solution
Accepted by topic author Zerged

answer is given here

0 Kudos
Message 3 of 5
(2,946 Views)

Yesss! That's the problem when posting the same question twice! Smiley Sad

In the future please do not repeat this: always post a single question in the international board, or post directly to the French board if you prefer your native language



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 5
(2,939 Views)

Thank's for your answers, I have found the solution ! 🙂

Ok I'll do not repeat this !

0 Kudos
Message 5 of 5
(2,928 Views)