Original Post
Is there a platform agnostic way to find the names of all the files in the current directory? What I have been doing up till now is redirecting the output from 'dir' to a file, reading it in and them deleting it. Obviously this only works on Windows. Similar things could be done for other platforms, but I would like to know if there is an easier way. I also need to know the directory the program is actually in. This doesn't coincide with the current directory, and I don't know how to find this out. The win32 API has a function GetModuleFileName that will tell me this, but how could I achieve the same thing under linux (for example)? Linux noob trying to port (and improve) a program I wrote a while ago.