Exercise caution when using "\" as the path separator during programming

Source: Internet
Author: User
When programming, use "\" as the path separator-general Linux technology-Linux programming and kernel information. The following is a detailed description. Note that when writing the code for creating a file, use "\" in the path of the windows system, and add an escape "\" to form a path similar to the following:

"Path \ fileName"

There is nothing wrong with this path in windows, but there will be problems in linux. in linux, a folder named "path \" will be generated, when you need to operate on the created file, the file cannot be found.

You can use "/" in the path to solve the problem, for example:

"Path/fileName"

However, in some cases, a problem may occur in the windows system. For example, click the button on the page and use "/scripts" in the action path to generate a. CSV file. Then, read the file and open it in a new window. This will occur in the original window and will not be opened in the new window. If "\" is used in the path, this problem can be solved. However, when running on linux, you will start to talk about it.

The final solution is: The Path separator added to the path changes with the system, that is, File. separator can be used to solve this problem.
Related Article

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.