Unrecognized escape sequence

VS 2005 WinXP

I am writing an application that will connect to the samba share.

However, a compilation error occurs in my path:

unrecognized escape sequence

I use this way:

string path = "\\Samba\sun005\admin_config\test.txt";

I also tried using double clearances:

string path = "\\Samba\\sun005\\admin_config\\test.txt";

However, the above compilation is good, but when it starts, it complains "cannot find the path"

Also tried the following:

string path = @"\\Samba\sun005\admin_config\test.txt";

When I check the debugger, I get the following line

\\Samba\\sun005\\admin_config\\test.txt

I am accessing in my exception. Now that I think about it. I did not set a username and password. I think this is my problem.

Thanks so much for any suggestions,

+3
source share
2 answers

UNC , , ( "" ). , sun005, :

"\\\\sun005\\admin_config\\test.txt"
@"\\sun005\admin_config\test.txt"
+11

\\Samba\sun005\admin_config\test.txt \Samba\sun005\x07dmin_config\x09est.txt. "\ s".

\\Samba\\sun005\\admin_config\\test.txt \Samba\sun005\admin_config\test.txt, , . "\\ Samba...."

@"\\Samba\sun005\admin_config\test.txt" - , ! , , , . , "\n".

+4

Source: https://habr.com/ru/post/1755650/


All Articles