char*
C++ で整数を a に追加するにはどうすればよいでしょうか?
ベストアンサー1
char*
まず、以下を使用してint を a に変換しますsprintf()
。
char integer_string[32];
int integer = 1234;
sprintf(integer_string, "%d", integer);
次に、それを他の char* に追加するには、次を使用しますstrcat()
。
char other_string[64] = "Integer: "; // make sure you allocate enough space to append the other string
strcat(other_string, integer_string); // other_string now contains "Integer: 1234"