ifstream - C++ : Dynamic C-String Usage in ifstreamObject.getline(c string, char limit) -
i wondering if there way dynamically allocate space char aray equal amount of spaces in line file while use getline method. (c++)
example
int main(){ char *theline; ifstream thefile; //set theline = new char[sizeofthefileline] //is there way above thefile.getline(theline, 500); return 0; }
if use std::getline
, desired behavior.
std::string theline; std::ifstream thefile; // .... std::getline(thefile, theline);
Comments
Post a Comment