Question:
C problem:?
vahid_saljooghi
2006-06-25 01:01:54 UTC
C problem:
I want to get list of folders of a drive(for example c:) for writing
NC program.what function should I use for this perpes
Four answers:
angel
2006-06-25 01:05:47 UTC
DONT KNOW WHAT TO TELL YOU MY FRIEND WOULD KNOW THE ANSWER BUT I DONT.. SORRY...
Alee
2006-06-30 22:27:09 UTC
In order to get the list of the files contained in a folder, IMO there is no direct function available in C that returns your desired result. However, you can use the combination of two functions findfirst and findnext (DOS, for Windows use FindFirstFile and FindNextFile)



First you call findfirst to get the first file of the files matching your criteria given in as parameter to findfirst function. Next you call findnext in a loop to get the next file. findnext returns 0 if successful or -1 if no more matching files are found. Both functions fill up fileinfo sturcture that contains the file name.
mashiur1973
2006-06-25 08:25:03 UTC
Finding files in C is done using two functions:-

findfirst & findnext.



The link below provides you an example to store the directory strure in a linked list.



http://www.cplusplus.happycodings.com/Data_Structures/code5.html
pachu_0072002
2006-06-25 08:08:58 UTC
I dont know sorry my friend


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...