Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse CSV from string/memory buffer #50

Closed
traversaro opened this issue Jul 14, 2020 · 2 comments
Closed

Parse CSV from string/memory buffer #50

traversaro opened this issue Jul 14, 2020 · 2 comments

Comments

@traversaro
Copy link

Hi @d99kris, thanks a lot for the great library!

I had a small question: it is possible to use rapidcsv to load csv text that has been already loaded in memory, for example that is contained in a std::string or a similar memory buffer? This is convenient when the CSV text to parse is not part of a file in a filesystem, but for example has been obtained from a network communication.

@d99kris
Copy link
Owner

d99kris commented Jul 14, 2020

Hi @traversaro - yes it is supported. Please check the details here: https://github.com/d99kris/rapidcsv#reading-csv-data-from-a-stream-or-string

Essentially rapidcsv can accept an std::istream, for example an std::stringstream, so you can do stuff like:

  std::string csv = "my,csv,data";
  std::stringstream sstream(csv);
  rapidcsv::Document doc(sstream)

@traversaro
Copy link
Author

Hi @d99kris, thanks a lot for the quick reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants