Sorell Stratège
Nombre de messages : 521 Localisation : Quel part où le sang coule. Date d'inscription : 01/05/2008
Feuille de personnage Surnom dans la team: Sénéchal Noir Victoire/défaite: (0/0)
| Sujet: TP3 Exercice 6 - Lun 17 Déc - 13:57 | |
| - Code:
-
/** * * @file FonctionGet.cxx * * @authors M. Laporte, D. Mathieu * * @date 18/11/2011 * * @version V1.0 * * @brief Concatenation des lignes d'un flux dans un string unique * **/
#include <iostream> #include <string> #include <fstream>
using namespace std;
namespace { void FonctionGet (void) { cout << "Lecture d'un fichier par la fonction Get()\n\n"; ifstream is; for ( ; ! is.is_open(); ) { string FicSource; cout << "Nom du fichier source : "; getline (cin, FicSource);
is.open (FicSource.c_str ());
if (!is.fail ()) break; cout << "Le fichier " << FicSource << " ne peut etre ouvert en lecture\n"; is.clear(); } for (char C = is.get(); ! is.eof (); C = is.get()) cout << C ; } // FonctionGet() } // namespace
int main (void) { /* * / Flux_cin (); /* */ /* * / AffichFich (); /* */ /* * / NomFichAuKbd (); /* */ /* * / ValidFichier (); /* */
/* * / ExtractionMots (); /* */ /* * / ExtractionCars (); /* */ /* * / ExtractionEntiers(); /* */ /* * / ExtractionReels (); /* */
/* */ FonctionGet (); /* */
return 0;
} // main()
| |
|