 <p>Since you're using Windows, <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms683197.aspx" rel="nofollow">GetModuleFileName</a> should do the trick. Just pass <code>NULL</code> for the <code>hModule</code> parameter. Be sure to read the documentation carefully if you want to handle long file names (and you typically do). You'll also have to strip the name of the executable to get the directory path. A quick-and-dirty way to do so is to remove everything after the last <code>\</code>.</p>