char message[512];
string info;
...
// read from txt file and save to "info"
...
message = info.c_str();
The error is caused by "message" on the last line. I'm not familiar with C or C++, can someone tell me what went wrong?
char message[512];
string info;
...
// read from txt file and save to "info"
...
message = info.c_str();
The error is caused by "message" on the last line. I'm not familiar with C or C++, can someone tell me what went wrong?
const char *message; // needs to be a pointer, not an actual array
string info;
...
// read from txt file and save to "info"
...
message = info.c_str();
You can do this:
strncpy(message, info.c_str(), sizeof(message));
message[sizeof(message) - 1] = '\0';