Question

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.

Was it helpful?

Solution 2

The following works FreeBasic

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

I recommend the FreeBasic IDE FBIde.

OTHER TIPS

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.

"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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top