How to enable the createfile above com10 serial port

Source: Internet
Author: User

This problem occurs during a serial communication. If COM1 to com9 is enabled normally and com10 or above is disabled, use getlasterror to check whether the specified file cannot be found for the error bit and then view msdn. The explanation is as follows:

Windows NT: You can use paths longer than max_path characters by calling the wide (w) version of createfile and prepending "\\? \ "To the path. "\\? \ "Tells the function to turn off path parsing. This lets you use paths that are nearly 32,000 Unicode
Characters long. however, each component in the path cannot be more than max_path characters long. you must use fully-qualified paths with this technique. this also works with UNC names. the "\\? \ "Is ignored as part of the path. For example ,"\\? \ C: \ myworld \ private"
Is seen as "C: \ myworld \ private", and "\\? \ UNC \ tom_1 \ hotstuff \ coolapps "is seen as" \ tom_1 \ hotstuff \ coolapps ".

When the path length is greater than max_path, add "\\? \ ", I guess, if the serial port is opened, only COM1 to com9 is supported. If the serial port is larger than 4 characters, it will not work. Therefore," \? "should be added to com10 or above "\\? \ ", That is

Createfile ("\\\\? \ Com10 ", generic_read | generic_write, 0, null, open_existing, file_flag_overlapped, 0 );

In this way, it can be opened successfully. All the above methods COM1 ~ 9 is also possible, so we suggest using this method.

Then you can see "\. \" on the Internet. You can try it and "\\? \ "Same, now I am thinking"?" What does it mean? Can it be changed to another symbol? I tried it later. I only needed to change it to ".". Please answer this question.

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.