M
Mr. Mxyztplk
So I've got Windows/DOS formatted base64 lines in a file, e.g.
ZE1ipHGlcWj4xISPGajKkV56emvBDHT862dCo72EDfWFmGlOh98xlYQY902uAjIy
QydwBgYcLYnCYOKXWwAePvHlouLugXCDFR1HLaKQ2/e51Qzn9yEEl4w+QPtd9G6y
RrzmDa2Pypcs9rwpD8TjExgK+40F/eMVWeduwpYPHsxO5ryldT1H9olQ15zK8pMQ
etc.
as per Dos\Windows we have a carriage return and line feed formation of
'\n' at the end of each of these lines. The upshot is that I want to
strip the newlines and process this as a continuous stream without said
newlines, e. g.
ZE1ipHGlcWj4xISPGajKkV56emvBDHT862dCo72EDfWFmGlOh98xlYQY902uAjIyQydwBgYc
LYnCYOKXWwAePvHlouLugXCDFR1HLaKQ2/e51Qzn9yEEl4w+QPtd9G6yRrzmDa2Pypcs9rwp
D8TjExgK+40F/eMVWeduwpYPHsxO5ryldT1H9olQ15zK8pMQ
(of course disregard the wrapping, it would be one long stream...)
and I want to do this in a manner more efficient than going through
every byte in the stream and erasing the newlines.
This code snippet
stringstream ss;
string line;
fin.open("ciphertext.b64", ios::in | ios::binary);
ss << fin.rdbuf();
fin.close();
getline(ss, line);
cout << line << flush;
getline(ss, line);
cout << line << flush;
is giving me the output
QydwBgYcLYnCYOKXWwAePvHlouLugXCDFR1HLaKQ2/e51Qzn9yEEl4w+QPtd9G6y
rather than what I should expect, i. e.
ZE1ipHGlcWj4xISPGajKkV56emvBDHT862dCo72EDfWFmGlOh98xlYQY902uAjIyQydwBgYc
LYnCYOKXWwAePvHlouLugXCDFR1HLaKQ2/e51Qzn9yEEl4w+QPtd9G6y
Harsh criticisms of my stunted coding would be much appreciated.
ZE1ipHGlcWj4xISPGajKkV56emvBDHT862dCo72EDfWFmGlOh98xlYQY902uAjIy
QydwBgYcLYnCYOKXWwAePvHlouLugXCDFR1HLaKQ2/e51Qzn9yEEl4w+QPtd9G6y
RrzmDa2Pypcs9rwpD8TjExgK+40F/eMVWeduwpYPHsxO5ryldT1H9olQ15zK8pMQ
etc.
as per Dos\Windows we have a carriage return and line feed formation of
'\n' at the end of each of these lines. The upshot is that I want to
strip the newlines and process this as a continuous stream without said
newlines, e. g.
ZE1ipHGlcWj4xISPGajKkV56emvBDHT862dCo72EDfWFmGlOh98xlYQY902uAjIyQydwBgYc
LYnCYOKXWwAePvHlouLugXCDFR1HLaKQ2/e51Qzn9yEEl4w+QPtd9G6yRrzmDa2Pypcs9rwp
D8TjExgK+40F/eMVWeduwpYPHsxO5ryldT1H9olQ15zK8pMQ
(of course disregard the wrapping, it would be one long stream...)
and I want to do this in a manner more efficient than going through
every byte in the stream and erasing the newlines.
This code snippet
stringstream ss;
string line;
fin.open("ciphertext.b64", ios::in | ios::binary);
ss << fin.rdbuf();
fin.close();
getline(ss, line);
cout << line << flush;
getline(ss, line);
cout << line << flush;
is giving me the output
QydwBgYcLYnCYOKXWwAePvHlouLugXCDFR1HLaKQ2/e51Qzn9yEEl4w+QPtd9G6y
rather than what I should expect, i. e.
ZE1ipHGlcWj4xISPGajKkV56emvBDHT862dCo72EDfWFmGlOh98xlYQY902uAjIyQydwBgYc
LYnCYOKXWwAePvHlouLugXCDFR1HLaKQ2/e51Qzn9yEEl4w+QPtd9G6y
Harsh criticisms of my stunted coding would be much appreciated.