A
Alexandros Frantzis
Hello,
I am trying to read a big file into a string. AFAIK std::string can read
in words or "lines" from a stream. So one option is to continuously
append all the "lines" from the file to the string.
The second option is to use the istream::read(Ch *p,streamsize n)
function and then create a std::string from 'buf'. However this is a
waste of time and space because (if I am not mistaken) the std::string
constructor will make a copy of the character array pointed to by buf.
Does anyone know any other (fast) way of doing this?
Thanks in advance,
Alexandros Frantzis
I am trying to read a big file into a string. AFAIK std::string can read
in words or "lines" from a stream. So one option is to continuously
append all the "lines" from the file to the string.
The second option is to use the istream::read(Ch *p,streamsize n)
function and then create a std::string from 'buf'. However this is a
waste of time and space because (if I am not mistaken) the std::string
constructor will make a copy of the character array pointed to by buf.
Does anyone know any other (fast) way of doing this?
Thanks in advance,
Alexandros Frantzis