LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Process multiple files in a single loop

Solved!
Go to solution

I am trying to harvest from data from multiple text files that I have in a folder.  Is there a function in CVI that could loop through the files that contain the data I need until it has gone through them all?  If not, all the files have a similar name (pucklocation.1, pucklocation.2, etc...).  Is there a way I could manipulate my cPath variable that I have when I call the functions below so that it does the first one, then increments to the next one, etc...

 

iIsGood = FileSelectPopup( "", "*.txt", ".txt", "Load", VAL_LOAD_BUTTON, 0, 1, 1, 0, cPath );
            if( iIsGood == 1 )
            {
                iFileHandle = OpenFile( cPath, VAL_READ_ONLY, VAL_OPEN_AS_IS, VAL_ASCII );

0 Kudos
Message 1 of 3
(3,343 Views)
I suggest you take a look at GetFirstFile ( )  and GetNextFile ( ) functions, that permits you to iterate through a set of files on disk and get the name of each of them for further handling.


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 3
(3,337 Views)
Solution
Accepted by neemtt
An alternative might be to use MultiFileSelectPopup instead of FileSelectPopup.
0 Kudos
Message 3 of 3
(3,287 Views)