2
我想知道是否有一種方法可以動態地將空間分配給字符aray,該空間等於文件行中空格的數量使用getline方法。 (C++)C++:ifstreamObject.getline中的動態C字符串用法(c字符串,字符限制)
例如
int main(){
char *theLine;
ifstream theFile;
//set theLine = new char[sizeOftheFileLine]
//is there a way do the above
theFile.getline(theLine, 500);
return 0;
}