Send SMS through a c program

Ya! You can! You can send an sms from your computer to any mobile using 3 lines of codings in c program!
Dont beleave?? Okay lets have a try…

First you should have gnokii package installed in your computer. Gnokii is a library for written in c to communicate with mobile phones from your computer. I tested this only on my ubuntu 9.04 so I don what windows users should do here.

Okay now connect your mobile phone with your computer with a data cable. This can be also done using mobile to pc blutooth connection! But this requires little more configurations with gnokii. Just forget it now.

Now open a note pad and write these c code below

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char **argv)
{
    FILE *file = popen("/usr/bin/gnokii --sendsms 880191xxxxxxx", "w");
    fwrite("HURRAY MSG IS GOING WITH C CODES!!", 1, 5, file);
    pclose(file);
    return 0;
}

Didnt you understand? This is actually… umm
Nothing…

This method is called pipelining. Actually gnokii is doing all that in background. If you open the terminal and enter this command “/usr/bin/gnokii –sendsms 880191xxxxxxx|HURRAY MSG IS GOING WITH C CODES!!” This would also work. Coz here “|” is causing pipelining between terminal standard input and gnkoiii process.
However,

here the c function popen is calling the process just as like a file. So that we can send command to that process just like an file write operation.

And dont try this too much…
Otherwise you would be out of your mobile balance soon…
Like me  :(

No related posts.

Tags: ,

To make money we lose our health, and then to restore our health we lose our money.... We live as if we are never going to die, and we die as if we never lived!

1 Comment Leave yours

  1. anik #

    Burhan Uddin,
    Bro. very nice …….

Leave a Reply