From: Jacques B. <jcq...@ya...> - 2016-03-08 06:52:53
|
HelloLong ago I wrote a REXX program to read a counter connected to my PC via a port com. Recently this program was no longer working.I used the forum entry https://sourceforge.net/p/oorexx/discussion/408478/thread/34d1c298/ to develop my code. In fact when reading the counter on COM20 I was receiving the previous writeS to the counter. The list of writeS was extended after each run of the failing program. This list was not reset by a boot of my PC. I deduced that this was a file and I found the file. In fact, the STREAM(name, 'C', 'OPEN BOTH') was opening a file instead of a comport.I dug a little further and found the reason :https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx#namespaces Here they say : For example, if you want to open the system's serial communications port 1, you can use "COM1" in the call to the CreateFile function. This works because COM1–COM9 are part of the reserved names in the NT namespace, although using the "\\.\" prefix will also work with these device names. By comparison, if you have a 100 port serial expansion board installed and want to open COM56, you cannot open it using "COM56" because there is no predefined NT namespace for COM56. You will need to open it using "\\.\COM56" because "\\.\" goes directly to the device namespace without attempting to locate a predefined alias. This is what I did and now my code work nice. I changed COM20 to \\.\COM20 I have not been able to add this comment to the forum entry. Can you please do so fo completeness on this topic. Thanks and regards, Jacques Bouchard La difficulté du business n'exclut pas la bonne humeur GPS: N49 22 04.8 E0 05 02.1 Dom.(SFR) +33 (0)2 14 09 61 14+33 (0)2 14 09 61 14 GSM: +33 (0)6 87 75 74 55+33 (0)6 87 75 74 55 CallSend SMSCall from mobileAdd to SkypeYou'll need Skype CreditFree via Skype |