D
David Bellot
Hi everybody,
I'd like to read part of a file directly into the internal buffer of a
string so that not to use the copy constructor to fill in my string.
What I did before was :
char buffer[1024];
ifstream f("my_file");
f.seekg(my_position);
f.read(buffer, my_size);
string s(buffer);
and the last line cost is that it uses a copy constructor to transfer
data from the buffer into the string's buffer. The file I wanna read is
really large (129Gb) and I don't wanna have to copy 129Gb for nothing.
The string is then used with a library (actually, it's the
Boost::tokenizer which requires a string).
Do you guys have a solution ?
Thanks,
David
I'd like to read part of a file directly into the internal buffer of a
string so that not to use the copy constructor to fill in my string.
What I did before was :
char buffer[1024];
ifstream f("my_file");
f.seekg(my_position);
f.read(buffer, my_size);
string s(buffer);
and the last line cost is that it uses a copy constructor to transfer
data from the buffer into the string's buffer. The file I wanna read is
really large (129Gb) and I don't wanna have to copy 129Gb for nothing.
The string is then used with a library (actually, it's the
Boost::tokenizer which requires a string).
Do you guys have a solution ?
Thanks,
David