无法识别的转义序列 [英] unrecognized escape sequence

查看:220
本文介绍了无法识别的转义序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VS 2005的WinXP

VS 2005 WinXP

我写这将连接到Samba共享的应用程序。

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

不过在我的道路,我得到一个编译错误:

However, in my path I am getting an compile error:

unrecognized escape sequence

我使用的路径是这样的:

The path I am using is this:

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



我也试过以下采用双晃动:

I have also tried the following using double backlashes:

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



不过,上述编译好了,但是当它运行时抱怨找不到路径

However, the above compiles ok, but when it runs it complains "cannot find the path"

也尝试了以下内容:

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

当我在调试器中,我得到以下字符串检查

When I check in the debugger I get the following string

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

我可以访问我的例外拒绝。现在,我想这件事。我没有设置用户名和密码。我觉得这是我的问题。

I get access denied in my exception. Now that I am thinking about it. I haven't set the username and password. I think that is my problem.

任何建议非常感谢,

推荐答案

一个UNC路径应只是包括计算机名,共享名,相对的路径到共享点(包含一个桑巴计划是没有必要的)。在机器名称为sun005的情况下,无论是两个以下应工作:

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"

这篇关于无法识别的转义序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆