As the other questions have highlighted, using std::getline
is unlikely to be the best choice here (partly because there is a risk of confusing a bit sequence with the separator).
Instead, it is recommended to use ifstream
with std::basic_istream<CharT,Traits>::read
in this case. Here is an example.