Directory functions - get file list

Posted By: BobbyT

Directory functions - get file list - 07/07/17 15:04

Hello all,

Does Zorro have any directory related functions. I have only been able to find file related functions (defined in stdio.h).

Specifically, I would like to get a list of files in a directory (excluding it's sub-directories) and loop over them and do some stuff.

Is this possible (with native Zorro) or will I have to create a list of synthetic file names and look for them in the directory one by one (using the stdio file file_length() function).

Cheers,
BobbyT

PS: I think dirent.h is what I'm after but it has a lot of dependencies, even in native C. It would be no small feat to port stdio.h over to Zorro (if it's even possible) for someone like myself who is just starting out with 'true' C based languages. A ready implementation would make for an easy life laugh
Posted By: jcl

Re: Directory functions - get file list - 07/10/17 15:29

Look into the Windows API. If I remember right the directory functions have names like FindFirstFile, FindNextFile and so on.
Posted By: BobbyT

Re: Directory functions - get file list - 07/10/17 17:39

Thanks JCL. I'll dig into this when I get home today.

I have cooked up an alternative based on synthetic file names but API functions may be a more efficient way to go.

Cheers,
BobbyT
© 2024 lite-C Forums