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)
|