How do I dial a modem from within a CA-Clipper application?

The modem on a serial port can be looked at as just another file as far as output is concerned. (This is a useful oversimplification.) You just need to open the serial port as a file and write a string such as "ATDT123-4567" followed by a carriage return and line feed to send a Hayes-compatible dial command to the modem. A function like this would do the job nicely:

 


FUNCTION dialphone (nPort, cNumber)
LOCAL nFile := FCREATE ("COM" + STR (nPort, 1))  // Open port
FWRITE (nFile, "ATDT"+cNumber+CHR(13)+CHR(10))   // Write ATDT command
FCLOSE (nFile)                                   // Close it
RETURN NIL