我读取的注册表下的HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Paths的Directory键值,我想在读到的值后加一个“\*.*"字符但我发现用读取后的值进行如下运算会无效如:
lpData & "\*.*"
这是怎么回事,如果不加一个"\*.*"就无法使用dir()函数了,我该怎么办?

解决方案 »

  1.   

    CString spath;
    spath.Format("%s%s",lpData,"\\*.*");
      

  2.   

    对啊,转义字符要牢记!或者用C语言代码
    -------------------------------------
    char szPath[100];
    sprintf(szpath,"%s%s",lpData,"\\*.*");
      

  3.   

    特殊字符的使用:
    \a
     Bell (alert)
     
    \b
     Backspace
     
    \f
     Formfeed
     
    \n
     New line
     
    \r
     Carriage return
     
    \t
     Horizontal tab
     
    \v
     Vertical tab
     
    \'
     Single quotation 
     
    \" 
     Double quotation 
     
    \\
     Backslash
     
    \?
     Literal question 
     
    \ooo
     ASCII character in octal notation
     
    \xhhh
     ASCII character in hexadecimal notation