string - c++ ifstream to char * -
my code reads file ifstream , parse it, changed things , don't need read file, 'cause read place, have char* instead ifstream... how can change code use ifstream.get()? again
you put char * std::stringstream.
std::stringstream buffer(your_string); you can use buffer std::ifstream (you cannot open or close it). ideally, parse-method take reference std::istream parameter, not mind kind of input-stream receives:
void parse(std::istream & input); since both std::ifstream , std::stringstream inherit std::istream, can pass them parameters, , parser runs without modifications.
Comments
Post a Comment