This is a fairly complicated question, so just some general advice on where to look would be great. I don't expect someone to write this for me.
Basically what I need is a platform independent way to do two things.
1) Get the present working directory
2) Sequentially open every file with a given extension in that directory.
Platform independence is key. This is easy to do using Win32, but I need something that works across various flavors of Unix and Linux so it has to be standard ANSI C.