Created
February 19, 2019 03:47
-
-
Save ivder/69fcf6cde8fb26b5ba0f3c08f440d2ce to your computer and use it in GitHub Desktop.
Read information from CSV format file and skip first several (7) lines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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