"/" and "\" in the C language file path

Source: Internet
Author: User

In the case of different systems windows is under \,linux and UNIX is/But there is no essential difference in win.

However, because \ is also the starting character of the escape character, \ \ Usually needs to be used in the path \ \

If it is/you do not need to use escape

such as the file operation in C,

C:\\kkk\\dd.txt double anti-slash!

Like C:/kkk/dd.txt.

"\" is usually a local directory, such as the C:\windows\ inside your computer.

"/" mainly means a remote computer or network, such as the address of your post:
Http://zhidao.baidu.com/question/36480033.html

"\" In DOS means that the right-hand string is a subdirectory or file name under a directory with the name of the left string;
For example, C:\bb\aa.bat represents the Aa.bat file in the BB subdirectory of the C packing directory.
"/" I've never seen a file path, if it's a sowing case
c:\bb\aa.bat/cc
is the required parameter for the Aa.bat operation.
The most other is the use of the network, look at your address bar.
The problem is not clear, answer these first.

The file path under Windows is delimited, for example, C:\Windows\System32\ is a standard Windows path.
In the C language, the file path is written as a string, but because the \ character is the guide to the escape character in the C-language string rule, write directly
"C:\Windows\System32\"
Will go wrong. and the character ' \ \ ' is the expression \.
So when you write a path, you have to be
"C:\\windows\\system32\\"

That is, written as a separate \, is the standard form of Windows, and written in \ \ is the C language used in the form.

"/" and "\" in the C language file path

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.