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: 

Write data to multiple text files after specific size

Hello,

I wrote a code that contineously writes data to a text file. The problem is I am running this VI for long time and therefore this text file is being bigger in size e.g. more than 20MB. I want to split writing data in this text file after max 2MB size. How can I do it? this is my programm .vi

Thank you,

0 Kudos
Message 1 of 3
(1,771 Views)

Hi ki4kou,

 

I want to split writing data in this text file after max 2MB size. How can I do it?

Like this:

fh = open(filename)
WHILE
 write(fh)
 IF FileSize(fh) > 2MB THEN
  close(fh)
  fh=open(new file name)
 ENDIF
WEND
close(fh)

In the file functions palette you will find functions for opening and closing files. And for getting the filesize…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(1,769 Views)

ok i will see

0 Kudos
Message 3 of 3
(1,727 Views)