User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:examples:talk_to_a_modem
click
to support this page (eg 0,42 € or so) Thanks.

Talk to a Modem

This is a Simple source how to Access a Modem.
it is very simple, just write a Modem Command to your Serial Port
in this case a serial Port ttyS0 in Linux

C Sourcecode to acces a modem

#include <stdio.h>
#include <unistd.h> // for sleep
 
/**
 * argument 1 is the number to dial
 * for this example you need a modem on Serial Port (in linux)
 */
int main(int argc,char *argv[])
{
    FILE *modem;
    char get[100];
 
    modem=fopen("/dev/ttyS0","rw");
    fprintf(modem,"ATZ\r\n");
    fscanf(modem,"%s",get);
    printf("%s\n",get);
    fprintf(modem,"ATDT%s\r\n",argv[1]);
    sleep(2);
 
    fclose(modem);
    return 0;
}
advertising
c/examples/talk_to_a_modem.txt · Last modified: 2013/01/22 22:02 (external edit)

Impressum