Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can we write a program to send SMS and display the received SMS using only C program?

What I have tried:

This was the code I was trying but I couldn't get any positive result.

Main
C++
#include<stdio.h>
#include<stdlib.h>

void read();
void send();

extern char *ptr;

void main()
{
// char *ptr;
int o;

while(1)
{
printf("Select your option\n");
printf("1. To SEND msg\n");
printf("2. To RECIEVE msg\n");
printf("3. To EXIT\n");

scanf("%d",&o);

switch(o)
{
case 1:
{
send();
//read();
}break;

case 2:
{
read(ptr);
}break;

case 3:
{
exit(EXIT_SUCCESS);
}
}
}
}

Sender
C++
#include<stdio.h>

char *ptr;

void send()
{
// printf("%p\n",ptr);
// char *ptr;
char s[50];

printf("Enter the messege\n");

scanf("%s",s);

ptr = s;

printf("%p\n",ptr);
printf("%c",*ptr);
printf("add of str %p\n",&s);
// return ptr;
}

Receiver:
C++
#include<stdio.h>
#include<string.h>

char *ptr;

void read()
{
printf("%p\n",ptr);

while(*ptr != '\0')
{
printf("%c",*ptr++);
}
// char s[50];
// strcpy(s,*ptr);
// printf("%s",s);
}

Reply
Posted
Updated 14-Dec-17 20:23pm
v2

1 solution

Yes.
All you have to do is fill in the send and read functions with the code to send the appropriate AT codes to the right COM port.
Or you could use Twilio or Libcurl.

But we are not here do your work for you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900