Double backslash not work?

泪湿孤枕 提交于 2019-12-11 06:28:28

问题


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"   // doesn't work

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

Any help welcome, RM


回答1:


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




回答2:


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?



来源:https://stackoverflow.com/questions/729151/double-backslash-not-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!