Wednesday, April 20, 2011

Double backslash not work?

Hi, does anybody have idea why some windows XP installation would not evaluate path with double backslash in them?

Error is found on some XP (same build, patches, unknown more details). In most everything works, on some PCs following doesn't work:

Querying path (registry or folder) with functions like RegEnumKeyEx, fopen fails if path contains two backslashes, for example "C:\\test\hello.txt".

strPath = "\SOFTWARE\Microsoft\Windows\Currentversion\run" works

strPath = "\SOFTWARE\Microsoft\Windows\Currentversion\\run" doesnt...

Is there some policy option or setting which can affect it?

Any help welcome, RM

From stackoverflow
  • Possibly completely unrelated, but in C/C++ (and other languages too) - "c:\\test\hello.txt" is okay, but "c:\test\hello.txt" is not (because '\t' is parsed as a tab character, so you get a name that doesn't really exist).

    Is there a chance the failure happens when the two backslashes don't exist, and things work when they do?

  • Why don't you simply modify the path to only have a single \ before using it?

0 comments:

Post a Comment