Take the 2-minute tour ×

Hey, I wanted to know if anyone can tell me what the difference between "file.file" and "./file.file" is. It seems to make quite a significant difference in my programs to call OpenFile("./file.file");

EDIT: My mistake, I thought my question was a generic one. This is in C++ using standard library functions.

share|improve this question
What language are we talking about? –  Amber Dec 10 '09 at 0:01
C++. My mistake, I thought that my question was generic. –  Orm Dec 10 '09 at 0:06
More useful would probably be stating that you're working with WinAPI functions (or at least I'm guessing that's what you're doing). –  Amber Dec 10 '09 at 0:07
Not in a thousand years would I use the WinAPI for personal projects my friend. Job, sure! Classes, maybe. Personal, oh HELLZ no. –  Orm Dec 10 '09 at 0:11
Not sure what "standard library" you're using then - the C++ standard library doesn't have an OpenFile function. Are you thinking of some other less generic "standard library"? –  Amber Dec 10 '09 at 0:12
show 1 more comment

2 Answers

up vote 2 down vote accepted

In general, "./File" will be relative to the directory that your program's context is currently executing in.

Just "File" will be relative to the directory that the program executable resides in.

This is pretty dependent on what tool or language you're using, however.

share|improve this answer
Thank you, that clears it up for me. Always good to know the reasons why something works than just roll with it. –  Orm Dec 10 '09 at 0:24
add comment

If you're referring to the WinAPI function, see the remarks section on this MSDN page:


If the lpFileName parameter specifies a file name and extension only, this function searches for a matching file in the following directories and the order shown:

  1. The directory where an application is loaded.
  2. The current directory.
  3. The Windows system directory.
  4. The 16-bit Windows system directory.
  5. The Windows directory.

The ./file.ext means that it must be in the current directory, whereas not specifying a directory means it can be in any of the places normally checked.

share|improve this answer
add comment

Your Answer


