VS 2005 WinXP
I am writing an application that will connect to a samba share.
However, in my path I am getting an compile error:
unrecognized es
A UNC path should just include the machine name, the share name, an the path relative to the share point (inclusion of a "samba" scheme is not necessary). In the case of the machine name being sun005, either of the two following should work:
"\\\\sun005\\admin_config\\test.txt"
@"\\sun005\admin_config\test.txt"
The compiler sees \\Samba\sun005\admin_config\test.txt
as \Samba\sun005\x07dmin_config\x09est.txt
. But it just doesn't understand the '\s'.
It sees \\Samba\\sun005\\admin_config\\test.txt
as \Samba\sun005\admin_config\test.txt
which the compiler is happy with, but you really need the two slashes at the start. For that you need to use four slashes "\\Samba...."
@"\\Samba\sun005\admin_config\test.txt"
is exactly what you want! You see the extra slashes in the debugger, because the debugger it adding them, so you can see what is really in the string. If you had a newline character in the string, it would display as '\n'.