TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: DARIN MCBRIDE
from: GERRY DANEN
date: 1998-01-07 20:33:00
subject: sending AT commands

 TH> I am trying to send 'AT' commands to a modem. "fopen" doesn't seem to
 TH> work. Can someone post a snippit of code demonstrating how to open a
 TH> port to COM3: and sending AT commands to it. A com port library is
 TH> fine. I don't have any on file.
 DM> Depends on your OS. For example, under Linux, OS/2, and likely Win32,
 DM> fopen would work. Under DOS, however, you need to either get a com
 DM> port library, learn how to use a FOSSIL, or learn how to deal with the
 DM> serial port on a low level (via outportb/inportb).
Not so. The following works just fine under DOS:
  void offhook( void )
  {
    FILE *port ;
    port = fopen( "COM1", "w" );
    fprintf( port, "ATM0H1\n" );
    fclose( port );
  }
Gerry Danen (gdanen@connect.ab.ca) C+Net BBS @ 403-477-9545
            http://www.geocities.com/SiliconValley/Way/9823
1 year, 358 days, 3 hours, 27 minutes, and 19 seconds until January 1, 2000.
--- Maximus 3.01
---------------
* Origin: C+Net BBS. Programming & Networking. (1:342/601)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.