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.