Opening a COM port in QBasic on Windows 7

孤人 提交于 2019-12-11 12:29:20

问题


I'm having difficulty opening a COM port in QBasic (obtained from www.qbasic.net) like so

OPEN "COM4:9600,N,8,1,BIN" FOR OUTPUT AS #1

However when I execute this statement in QBasic the open keyword is highlighted and I get the error message Bad file name.


回答1:


Is Com4: one of the available serial ports? Look in control panel and make it is one of the available ports. Also, you must make sure no other programs have the port open.




回答2:


The following works FreeBasic

Open Com "COM1:9600,N,8,1" As 1

I recommend the FreeBasic IDE FBIde.




回答3:


"COM4:9600,N,8,1,BIN"

The semantics for opening files changed in Win2K. On NTFS, the colon indicates an Alternate Data Stream, and the DOS use of the colon when opening serial devices was not implemented.

So on Win7, "COM4:9600,N,8,1,BIN" is a bad filename.



来源:https://stackoverflow.com/questions/19317679/opening-a-com-port-in-qbasic-on-windows-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!