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

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -