Is there any need to escape a Registry Key path when reading it from a file?
eg. For the path : HKEY_USERS\.DEFAULT

When reading input from a file , is there a need for escaping the'\'?

If I use " HKEY_USERS\\.DEFAULT", I get the same string " HKEY_USERS\\.DEFAULT" back - why is the '\' not getting escaped?

Will it always hold that both '\' are present when I read the path from the file?

>>Is there any need to escape a Registry Key path when reading it from a file

No -- escape characters are only useful for string literals which are interpreted by the compiler at compile time.

Thanks Ancient Dragon!!

Could you let me know why this is?
I'm using VS.net 2003

In a Application [.exe] configuration type project , I had no trouble opening a file using this path "./FileName.txt"

In a second Static Library Configuration type project , the same "./FileName.txt" does not work, Can project settings influence the way escape characters work?

>>Can project settings influence the way escape characters work?
No -- they are set by the C and C++ standards and work the same way with all standards-compliant compilers. Your problem is something else. Did you check the file system to see that the file is where you think it is? If you are trying to use it in different projects then you will need a copy of that file in each project directories. If you want just one copy of that file then you will have to specify the full path to it instead of the relative path, or change directories (e.g. chdir() ) bto where the file is located before attempting to open it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.