私はこのサイトとGoogleでも検索しました。しかし、私は見た多くのコードを理解することができませんでした、そして、ここからより直接的な助けを探したいと思っています。私の上司のためにやっているようなサイドプロジェクトIDがあります。.csvからC++の配列にデータを読み取る
彼はコールログ用のcsvファイルを生成しています。私はログから特定の行を取り出し、データを計算して表示できるようにしたいと考えています。私はHERESに私は(私のプログラミングの知識はかなり時間不足と経験:)
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{
//opens the csv file.
ifstream gwfile;
gwfile.open("log.csv");
if(!gwfile) { // file couldn't be opened
cout << "FAILED: file could not be opened" << endl << "Press enter to close.";
cin.get();
return 0;
}else
cout << "SUCCESSFULLY opened file!\n";
cout << "-------------------------------------------------------------------------------\n\n\n";
long int SIZE = 0;
char data[SIZE];
cout << "This is data SIZE:" << data[SIZE] << endl;
//in the csv im trying to only read lines that start with the voice as those are only valid data we need.
//also i would like to display the headings in teh very first line
while(!gwfile.eof()){
//This is where im trying to only accept the lines starting with "Voice"
//if(data[SIZE] == "Voice"){
for(int i=0; i!=","; i++){
cout << "This is i: " << i << endl; //testing purposes.
}
//}
// getline(gwfile, data, '');
// cout << data[0];
}
return 0;
}
に限定されているデータを取得を開始しようとしたが、問題に走った私のコードを尋ねるが、する必要があり、正確な質問の
イムわかりません
C++でこれを行う特別な理由はありますか? –
私はC++だけしか知りません。それは私のための素晴らしい仕事のようでした。 – Nickoli
その他のヘルプ? – Nickoli