Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to read string from serial port for bar code app
Message
From
01/05/2002 11:56:11
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Need to read string from serial port for bar code app
Miscellaneous
Thread ID:
00651375
Message ID:
00651375
Views:
107
I am developing a bar code application. The application does not have a user interface. Data comes in from an RF scanner to the serial port. There is a program called Portkey that converts the serial port data to keyboard input. So the recorded scan comes in as a string of characters with a carriage return. Right now the application has a single textbox on a vfp 6 form. The focus always stays in the text box. When a scan is recorded the textbox's valid fires, and the valid calls a method that processes the scan data.

The problem is that this method relies on the focus staying in the textbox. If a user hits the keyboard, or clicks the mouse to another application, etc. the application obviously stops working.

So, ideally I need a way to directly record the serial port data. The VFP help says that fgets() records bytes directly from a file or communication port opened with low-level file i/o. But I don't know the syntax for opening the port with fopen() - assuming that is what I am supposed to do.

Can what I am trying to do be accomplished simply with fopen() and fgets(), or do I need some sort of communication library or control? How would I poll the port? Fgets() in a loop, or on a timer?

TIA for any suggestions.
Next
Reply
Map
View

Click here to load this message in the networking platform