   Paths in C#, C++, and DirectX
  I am trying to reference files and I'm totally confused.  First, I am using Visual C# Express and Visual C++ Express.  There are a lot of pages that tell you just to put your files directly into C:\.  When I do that it works, but it doesn't make any sense and seems like a bad practice.Example:... Image.FromFile("\\whatever.gif") ;Looks in C:I would like to know how I can use the current directory as my "root" so that I can reference like FromFile("\\media\\whatever.gif") or whatever the correct syntax is without having to specify ("C:\Documents and Settings\blah\blah\whatever.gif").Anyway, I am also curious if it is different when using DirectX.  I was having some trouble using any paths except C:\ for that as well.Any help will be greatly appreciated,Aaron   
  For sure you should use relative paths. The path is relative to the working directory which will be where the project file is if you are running from within Visual Studio otherwise it will be where the .exe is located. Note that in Visual Studio you can set the working directory to something different via the project settings.   ;  I know I need to use the relative path.  It is the syntax I am confused about.  Also, I've read that the relative path starts in the bin\debug directory.  I may be way off.  That's what I don't know.Is it ("media\whatever.gif")or ("\\media\\whatever.gif")or ("\media\whatever.gif")or ...You get the point.  I just don't know how the syntax is for the references (in C#, C++, and DirectX).Do I have to set the relative path somehow?  Or is it automatic?ThanksAaron   ;Quote:Also, I've read that the relative path starts in the bin\debug directory. The relative path starts in the same directory where your application is located (by default, an alternative startup location may be specified when running the program). So for a typical debug build this will indeed be the bin\debug directory.Path name strings can be specified in strings by either escaping the backslash character with \\ or by prefixing the string with the literal string operator @, so like this:"\\some\\directory" or @"\some\directory"If you want to specify a relative path name, you should omit the first backslash or use a . prefix to indicate the current directory. So both@"some\directory" or @".\some\directory"should point to a relative path, that is bin\debug\some\directory in your example. You can also use the .. directory name to specify a directory higher in the hierarchy, so @"..\some\directory"will point to bin\some\directory. This can be quite useful and it's also used in the SDK samples, which typically refer to ..\..\media, so it doesn't matter if you're running the debug or release build. To be sure, using DirectX should not have any influence on these path names.Hope this helps [smile][Edited by - remigius on June 22, 2006 5:05:43 PM];  Awesome response.  Just how I like it.  Complete and comprehensive.  I really really appreciate it.Aaron   