CreateDirectory: Folder creation failed

Source: Internet
Author: User

When debugging the project created the previous day, we found that the CreateDirectory function failed to create a folder, but the returned value of this function

It is the value of success. This is strange. I thought my file system had a problem and asked my colleagues to test this function.

Same. What is going on? I figured it out. I guess there is a problem with the input parameters, because the char type I passed, but the CreateDirectory

The unicode version called, that is, CreateDirectoryW. So I set the project properties ----- General --- project default value --- character set options

Set it to 'unset', and run the task again. The result is displayed.

Instance code

# Include <Windows. h> int main () {char * path = "f: \ disk \ 11990"; int nr = 0; nr = CreateDirectory (path, NULL); return nr ;}

Although the problem is solved, it is still a bit strange. Why is the return value of unicode 1, which indicates success. Do not understand.

I hope you can help me.

 

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.