Friday, July 31, 2009

C problem:?

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

C problem:?
DONT KNOW WHAT TO TELL YOU MY FRIEND WOULD KNOW THE ANSWER BUT I DONT.. SORRY...
Reply: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.
Reply:I dont know sorry my friend
Reply:Finding files in C is done using two functions:-


findfirst %26amp; findnext.





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





http://www.cplusplus.happycodings.com/Da...


No comments:

Post a Comment