LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to have a progress bar monitor and display the progress of a file being opened, How do I do it?

I have written large files for a report. When I open the files in the VI by pushing a button I want to view the progress of the file being opened. My first thought was to get the file size, some how measure the number of bytes comming out and monitor it on the progress bar. I am unsure about how to do this. If you know of a better way to monitor and disply the progress of an opeing file please let me know.
0 Kudos
Message 1 of 2
(2,616 Views)
If I understand you correct the progress bar is not the problem, it's to get a numeric value indicating the progress...right?

If so then you could read the file size, preallocate a byte array to hold the file, then read it in chunks and put the chunks into the array using replace array elements...(you could concatinate strings, but that would easily become very memory and speed expensive...)until you have read the entire file. If the file is 20 MB and you want the progress bar to have a resolution of about 1% read it in chunks of 256 KB...For each chunk read, increment the progress bar...
0 Kudos
Message 2 of 2
(2,616 Views)