You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry to bother you again but after a couple of hours of beating my head against the wall I thought I would ask...below things are somewhat cobbled together and isn't what my code looks like exactly but just to show you what I am doing and the pieces involved. I have been loading from a file but decided having an option to load from a string would be useful. I keep getting the "ios_base::failbit set: iostream stream error". The csvstring gets passed in as a string parameter to the function. Can you see what I am doing wrong? I have tried a number of different things but always the same result. Thank you.
Hello @jtaylorme - I think the main problem in the provided code is that Load() is called with csvstring argument, rather than sstream. If I change the code to the following it seems to work (at least not throw exception):
rapidcsv::Document doccsv;
std::string csvstring =
"27502 919 35.74801 - 78.83401 A, PE, X NC Wake E 8374\r\n"
"27511 919 35.75124 - 78.70732 CARY NC Wake E 8812";
std::stringstream sstream(csvstring);
doccsv.Load(sstream, rapidcsv::LabelParams(0, 1),
rapidcsv::SeparatorParams(',' /* pSeparator */,
false /* pTrim */,
rapidcsv::sPlatformHasCR /* pHasCR */,
false /* pQuotedLinebreaks */,
true /* pAutoQuote */));
There's another Github issue #63 reported suggesting rapidcsv should provide more developer friendly exceptions. I hope I can find time to look into implementing that soon.
Sorry to bother you again but after a couple of hours of beating my head against the wall I thought I would ask...below things are somewhat cobbled together and isn't what my code looks like exactly but just to show you what I am doing and the pieces involved. I have been loading from a file but decided having an option to load from a string would be useful. I keep getting the "ios_base::failbit set: iostream stream error". The csvstring gets passed in as a string parameter to the function. Can you see what I am doing wrong? I have tried a number of different things but always the same result. Thank you.
Jim
`rapidcsv::Document doccsv(stringstream(""), rapidcsv::LabelParams(0, -1),
rapidcsv::SeparatorParams(',' ,false,rapidcsv::sPlatformHasCR ,false,true ));
string csvstring = "27502 919 35.74801 - 78.83401 A, PE, X NC Wake E 8374\r\n27511 919 35.75124 - 78.70732 CARY NC Wake E 8812";
The text was updated successfully, but these errors were encountered: