The backslash \ and slash/Transfer Character path in C #

Source: Internet
Author: User

backslash \ and slash/Transfer Character path in C #
in C #, \ is an escape character, as shown below

escape sequence character
\ 'single quotation marks
\ "double quotation marks
\ backslash
\ 0 null
\ a warning
\ B Return
\ f form feed
\ n line feed
\ r driving
\ t horizontal tab
\ v vertical tab

 
For example, if you want to output this string "/_ \", you may think it is as follows @""/_\""
But writing the compiler won't let you pass it, but as shown in the table above, you can write "\"/_ \ "" in this way "\"/_\\\""
In addition, many users prefer D: \ test.txt when obtaining the file path.
Then the so-called Escape Character error will occur.
The solution is to use @ D: \ test.txt. I don't know if this will cause some problems.
However, I have always done that D:/test.txt is completely accessible.
I found it online. It seems that the biggest difference between a slash and a backslash is
In the network, the command line parameters cannot be separated by a slash (/) in windows.
In a UNIX system,/indicates a directory. Because the Web Name follows the Unix name,/indicates the directory in the URL.
Backslash \, which is used to represent directories in windows.
But at least in directory access, no one has ever encountered a slash problem. Which one has encountered a similar problem and hopes to leave it on my blog? Thank you first.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.