Programming Reference/Librarys
Question & Answer
Q&A is closed
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
#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; }