1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
/////////////////////
/// Bibliothèques ///
/////////////////////
#include <stdafx.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <fstream>
#include <iostream>
#include <sstream>
using namespace std;
////////////////////////////////
/// Déclaration de Variables ///
////////////////////////////////
string colonne1;
string colonne2;
string colonne3;
string colonne4;
string colonne5;
string colonne6;
string colonne7;
string colonne8;
///////////////////////////
/// Programme Principal ///
///////////////////////////
int _tmain(int argc, _TCHAR* argv[])
{
ifstream fichier1("C:\\Documents and Settings\\bastien\\Bureau\\Offres - Tables EDI Excel\\20090727-TABLES_EDI.csv");
if(fichier1 != NULL)
{
string ligne; // variable contenant chaque ligne lue
// cette boucle s'arrête dès qu'une erreur de lecture survient
while ( getline( fichier1, ligne, ';' ) )
{
getline( fichier1, colonne1, ';' );
//cout << colonne1 << endl;
getline( fichier1, colonne2, ';' );
//cout << colonne2 << endl;
getline( fichier1, colonne3, ';' );
//cout << colonne3 << endl;
getline( fichier1, colonne4, ';' );
//cout << colonne4 << endl;
getline( fichier1, colonne5, ';' );
//cout << colonne5 << endl;
getline( fichier1, colonne6, ';' );
//cout << colonne6 << endl;
getline( fichier1, colonne7, ';' );
//cout << colonne7 << endl;
getline( fichier1, colonne8);
//cout << colonne8 << endl;
cout << colonne1 << "\t" << colonne4 << endl;
}
}
else
cout << "Erreur lors de l'ouverture du fichier 20090727-TABLES_EDI.csv" << endl;
return 0;
} |
Partager