0
votes

I'm trying to write a program that will send text messages to my phone through an email, and I have finished dealing with smtp and all that jazz, so the technical part is done, it works, I just want to be able to type in the program the body/message I want to send; this is what I have:

int choice;
cout << "Welcome\n 1:send a text message\n 2:quit\n";
cout << "type either 1 or 2: ";
cin >> choice;
if (choice == 1)
{
const char* message;
cout << "What would you like to send?: ";
cin >> message;

I set up mailing the email inside the if statement, where I put

mail.SetLogin("******");
mail.SetPassword("********");
mail.SetSenderName("****");
mail.SetSenderMail("***@gmail.com");
mail.SetReplyTo("");
mail.SetSubject("text");
mail.AddRecipient("******@tmomail.net");
mail.SetXPriority(XPRIORITY_NORMAL);
mail.SetXMailer("The Bat! (v3.02) Professional");
mail.AddMsgLine(message);

I'm getting a error message saying = Error no operator ">>" matches these operands operand types are std::istream >> const* char

I know I goofed setting up the variable for message, and it's looking for it in the #include library, if anyone knows how to fix this I would be super grateful.

btw my #includes I have right now are

#include "CSmtp.h"
#include <iostream>
#include <Windows.h>
1

1 Answers

4
votes

There's no >> overload that will stream text into a const char *. Instead use a std::string.