私はこのようないくつかの機能を持っています:
void MClass::GetS(char* buf, int max) const {
char *temp = new char[max];
temp[max] = '\0';
for (int i = 0; i < max - 1; i++)
temp[i] = src[i]; // src is class member (char *)
buf = temp; // buf is null after this o.O
}
そのため、この関数でbuf値を変更することはできません。なぜそれが起こるのですか?