LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Why did I get such result using GetFirstFile and GetNextFile in one dir?

I think final result should be a list by time or names of files,but not.You can see the acquired files in 1.txt file of ATTACH FILES using GetFirstFile and GetNextFile.
following is my program code
error=GetFirstFile (filenameZ, 1, 0, 0, 0, 0, 0,FilesName[0]);
while(error==0)
{

i0++;
error=GetNextFile(FilesName[i0]);

}
0 Kudos
Message 1 of 4
(4,256 Views)
Hi,

This is strange, the list is usully in alphabetical order. I did some testing here and I always read the file list in alphabetical order. Make sure that you write te data to the file in the same order that the data was read. Also makes ure that you delete the conten of the file prior to adding new data. It is possible that you are looking at accumulated data.


Please take a look at this small example that lists the files in a directory. Let me know if you have any further questions.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 2 of 4
(4,256 Views)
You can test using ATTACH FILES,the data was written into files by 'fprintf'.No change is my answer:(.thank you.
0 Kudos
Message 3 of 4
(4,256 Views)
I ran the application that I posted here and it works perfectly. You can see that the results in the list are ordered alphabetically. You can test it out with different directories and the files are allways listed in order.

My guess is that there are some problems with the way that you write to the file. Check the way that you hanlde the arrays of string and make sure that the file is empty before you write to it.

I hope this helps.

Juan Carlos
0 Kudos
Message 4 of 4
(4,256 Views)