私は C++ を初めて使用し、まだすべての概念を完全に把握していないため、この関数が機能しない理由に困惑しています。私は現在家にいないので、まだコンパイラ エラーを投稿することはできません。家に帰り次第投稿します。
これが関数です。
const char * ConvertToChar(std::string input1, std::string input2) {
// Create a string that you want converted
std::stringstream ss;
// Streams the two strings together
ss << input1 << input2;
// outputs it into a string
std::string msg = ss.str();
//Creating the character the string will go in; be sure it is large enough so you don't overflow the array
cont char * cstr[80];
//Copies the string into the char array. Thus allowing it to be used elsewhere.
strcpy(cstr, msg.c_str());
return * cstr;
}
2 つの文字列を連結して変換し、const char * を返すように作られています。これは、使用したい関数が const char ポインターを渡す必要があるためです。