GetCurrentDirectory()

This is a discussion on GetCurrentDirectory() within the Windows Programming forums, part of the Platform Specific Boards category; Is it needed to change all \ to \ when you use GetCurrentDirectory()? For instance, I want to create a ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21