Q37347: "Device Unavailable" on OPEN "COM1:" Compiled with BC /O/S
Article: Q37347
Product(s): See article
Version(s): 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | B_BasicCom buglist4.00 buglist4.00b buglist4.50 | mspl13_basic
Last Modified: 12-JAN-1990
A program that accesses the serial communications ports with OPEN
"COM1:" or "COM2:" produces a "Device Unavailable" (run-time error 68)
message if it is compiled using BC.EXE with the /O (stand-alone .EXE)
and /S (minimize string space) options together.
To work around this limitation, do not use the /S and /O options
together when compiling programs that access the communications ports.
Microsoft has confirmed this to be a problem in Microsoft QuickBASIC
4.00, 4.00b, and 4.50 for MS-DOS and in Microsoft BASIC Compiler 6.00
and 6.00b (buglist6.00 buglist6.00b) for MS-DOS and MS OS/2. We are
researching this problem and will post new information here as it
becomes available. This problem does not occur in Microsoft BASIC PDS
Version 7.00 for MS-DOS and MS OS/2 (fixlist7.00).
The sample program below runs properly inside the environment;
however, when compiled to an .EXE file using the BC /O and /S options,
a "Device Unavailable" error message is produced on the OPEN "COM1:"
statement. [The problem can also occur when you use the ON COM(n)
GOSUB statement.]
The following is a code example:
OPEN "COM1:9600,N,8,1,CS,DS" FOR RANDOM AS 1
CLOSE 1
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.