The '\\' notation is only needed for the compiler. It isn't needed in the runtime. (when you select a file from the open file dialog, the path is returned as "C:\New Folder"
If you want to replace them for other reasons, then use 4 '\'. i.e. to specify a SMB server, you would use CString strServer = "\\\\server_name\\folder";.
To replace it you just need a replace function. If you are using something liks CString, it as a Replace() method.
CString strName = "\\hello";
//strName is now "\\hello" if it were printed to screen, or "\\\\hello" from the compilers view
I have to connect to WebDAV Server, example: http://webdav.pspace.co.kr
But I cannot find any code example for DavAddConnection Function.
And, in MSDN I found this:
"Use this function when you are connecting to a WebDAV server using the Secure Sockets Layer (SSL) protocol and therefore must specify a certificate. To connect to a WebDAV server without specifying a certificate, use a Windows networking function such as WNetAddConnection2 or WNetAddConnection3."
Does anyone know some examples of DavAddConnection?
Found some code examples for WNetAddConnection2 and tried to connect, but, unsuccessfully.
Running your code with locname=_T("\\\\webdav.pspace.co.kr\\") and running a packet sniffer I get the response
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<title>401 Authorization Required</title></head><body>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
<address>Apache Server at webdav.pspace.co.kr Port 80</address>
I'm sure you can figure out what the problem is from the response
I have never used WNetAddConnection2, and what I have been telling you is from reading MSDN and running your code on my computer so i dont know of any reasons that this might be hapening. Since i dont have an account on webdav.pspace.co.kr[^] the best i can offer is that you run Wireshark[^] and start the sniffer while you try to connect to the server to see what the server is sending back to you.
lpLocalName should be NULL in you case
"A pointer to a null-terminated string that specifies the name of a local device to redirect, such as "F:" or "LPT1". The string is treated in a case-insensitive manner."
but you use webdav.pspace.co.kr, which may cause the problem I think...