char ch_ReadByte='H'; char *ptr_OneLineData; unsigned ); if ((ptr_OneLineData = (char *)malloc(bufsize)) == NULL) { AfxMessageBox(_T("内存申请失败!")); } else { memset(ptr_OneLineData, , bufsize);//成功申请后一定要重新填充0值到内存中 ptr_OneLineData[chNum] = ch_ReadByte;//使用下标访问 free(ptr_OneLineData);//用完后要free }