https://github.com/potatomaster101/csv
Quick and dirty CSV reader/writer
https://github.com/potatomaster101/csv
cpp17 csv-parser csv-reader header-only mit-license
Last synced: 11 months ago
JSON representation
Quick and dirty CSV reader/writer
- Host: GitHub
- URL: https://github.com/potatomaster101/csv
- Owner: PotatoMaster101
- License: mit
- Created: 2019-06-13T13:23:59.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2021-01-06T07:17:13.000Z (about 5 years ago)
- Last Synced: 2025-01-01T12:29:47.087Z (about 1 year ago)
- Topics: cpp17, csv-parser, csv-reader, header-only, mit-license
- Language: C++
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CSV Reader
I just want a quick and dirty header-only CSV reader in C++17.
## Usage
### Read line by line
```cpp
csv file{"file.csv"};
auto line = file.readline();
while (line) {
// do things with line.value()
line = file.readline();
}
```
### Read whole file
```cpp
csv file{"file.csv"};
for (const auto& line : file.readlines()) {
// do things with line
}
```
### Write CSV
```cpp
std::vector nums{1, 2, 3, 4, 5};
csv_write(std::cout, nums.begin(), nums.end());
```