Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - The problem of transforming CString into integer and char array in mfc, please come in (100)
The problem of transforming CString into integer and char array in mfc, please come in (100)
CString str = " 123 ";

//Convert to a character pointer

char *p = str。 GetBuffer (string. GetLength());

//Convert to int variable

int I = atoi(p);

Cout & lt& lt I<& ltendl

//Convert to floating-point variable

str = " 123.32 ";

float f = atof(str。 GetBuffer (string. GetLength()));

cout & lt& ltf & lt& ltendl