Thread: GetCurrentDirectory()

  1. #1
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640

    GetCurrentDirectory()

    Is it needed to change all \ to \\ when you use GetCurrentDirectory()? For instance, I want to create a file, so would it look something like this?

    Code:
    char szDir[512];
    GetCurrentDirectory(400, szDir);
    strcat(szDir, "\\filename.barf");
    ...
    Or would I have to change every \ in szDir to \\?
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > Is it needed to change all \ to \\ when you use GetCurrentDirectory()?
    No, the \\ rule only applies to those string constants which you write in your code.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    slick, thanks
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GetCurrentDirectory + '\\'
    By rotis23 in forum Windows Programming
    Replies: 4
    Last Post: 09-08-2003, 07:30 AM
  2. GetCurrentDirectory problems.
    By Bajanine in forum Windows Programming
    Replies: 2
    Last Post: 05-01-2003, 09:12 PM