I'm having a hard time figuring this out.
I want to open a file, but I don't know the filename. I know the directory the file resides in, and I know the extension ('.lay'), and I know there is only one file with that extension in the directory.

How can I do this and still have portable code?
I was thinking I could get the directory listing and test each file and see if it ends with ".lay".

Any other ideas out there?


ms-windows call GetFirstFile() and GetNextFile(), or in *nix call opendir() and readdir(). If you used c++ you can use boost library that is portable between these two operating systems (I don't know a thing about MAC).

Damn. I was afraid there wasn't a standard cross-platform way to do this. Oh well, I just have to write a wrapper, then.

Thanks for the fast reply :)


This question has already been answered. Start a new discussion instead.