Skip to content

Instantly share code, notes, and snippets.

@ivder
Created February 19, 2019 03:47
Show Gist options
  • Save ivder/69fcf6cde8fb26b5ba0f3c08f440d2ce to your computer and use it in GitHub Desktop.
Save ivder/69fcf6cde8fb26b5ba0f3c08f440d2ce to your computer and use it in GitHub Desktop.
Read information from CSV format file and skip first several (7) lines
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <iterator>
//#include "opencv2/imcodecs.hpp"
#include <sstream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
ifstream file_reader("GOPR0632.csv");
int cnt = 0;
//file_reader.ignore(341);
int i = 0;
while (!file_reader.eof()) {
string line;
cnt++;
getline(file_reader, line);
stringstream ss(line);
string token;
if (cnt > 7)
{
while (getline(ss, token, ',')) {
cout << token << " ";
}
cout << endl;
}
}
system("pause");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment