IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C++/CLI Discussion :

[Projet] Programme pour statistiques de fichiers textes


Sujet :

C++/CLI

  1. #21
    Inactif  
    Avatar de Mac LAK
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    3 893
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Octobre 2004
    Messages : 3 893
    Points : 4 846
    Points
    4 846
    Par défaut
    Citation Envoyé par marouane87 Voir le message
    S.V.P quels sont les commandes qui me permet de lire un fichier texte (ligne par ligne ou entier) en utilisant openfieldialog (ou autre commande)
    Les fonctions normales : ces boîtes de dialogue ne font QUE te fournir un nom de fichier, ni plus, ni moins. Elles ne l'ouvrent pas, et lisent/écrivent encore moins dedans.
    Mac LAK.
    ___________________________________________________
    Ne prenez pas la vie trop au sérieux, de toutes façons, vous n'en sortirez pas vivant.

    Sources et composants Delphi sur mon site, L'antre du Lak.
    Pas de question technique par MP : posez-la dans un nouveau sujet, sur le forum adéquat.

    Rejoignez-nous sur : Serveur de fichiers [NAS] Le Tableau de bord projets Le groupe de travail ICMO

  2. #22
    Membre du Club
    Inscrit en
    Novembre 2008
    Messages
    81
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 81
    Points : 54
    Points
    54
    Par défaut
    Oui et c'est ça que j'ai dis "ou autre" dans le cas où openfiledialog ne permet pas la lecture du fichier

  3. #23
    Inactif  
    Avatar de Mac LAK
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    3 893
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Octobre 2004
    Messages : 3 893
    Points : 4 846
    Points
    4 846
    Par défaut
    Citation Envoyé par marouane87 Voir le message
    Oui et c'est ça que j'ai dis "ou autre" dans le cas où openfiledialog ne permet pas la lecture du fichier
    Ben oui, mais là, direction la : Fichiers,Parcours,Recherche,Existence...
    Mac LAK.
    ___________________________________________________
    Ne prenez pas la vie trop au sérieux, de toutes façons, vous n'en sortirez pas vivant.

    Sources et composants Delphi sur mon site, L'antre du Lak.
    Pas de question technique par MP : posez-la dans un nouveau sujet, sur le forum adéquat.

    Rejoignez-nous sur : Serveur de fichiers [NAS] Le Tableau de bord projets Le groupe de travail ICMO

  4. #24
    Membre du Club
    Inscrit en
    Novembre 2008
    Messages
    81
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 81
    Points : 54
    Points
    54
    Par défaut
    Je n'ai pas trouvé mon bonheur dans la FAQ et après quelques recherches j'ai trouvé la commande streamreader...
    En tout cas, j'ai pu implémenter ce petit code permettant de lire le fichier ligne par ligne (s'il est faux svp corrigez le moi, la compilation se tourne bien mais je ne suis pas sûr du résultat):

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     StreamReader^ sr = gcnew StreamReader(openFileDialog1->FileName);
     
          {
             String^ line;
     
     
             while ( line = sr->ReadLine() );
     
    int i=0;
    		i=i+length(line);
          }
    Cela est dans le but de compter le nombre de caractère mais il me dit que length est un identificateur introuvable

  5. #25
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 071
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 071
    Points : 12 116
    Points
    12 116
    Par défaut
    Et la fonction "length", elle sort d'où ?
    A moins que cela soit une des méthodes de votre objet courant ?

    Il faudrait penser à lire un peu la documentation avant de faire du copier-coller de n'importe quoi.
    http://msdn.microsoft.com/en-us/libr...ng.length.aspx

    P.S.: Quand vous ouvrez un stream, pensez à utiliser try{}finally{} pour le fermer correctement, c'est aussi dans la doc (voir exemple).
    http://msdn.microsoft.com/en-us/libr...eamreader.aspx


  6. #26
    Membre du Club
    Inscrit en
    Novembre 2008
    Messages
    81
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 81
    Points : 54
    Points
    54
    Par défaut
    J'ai déjà lu ces deux documents et ça ne m'a amené qu'à perdre une autre nuit devant le PC sans avancer dans le projet...
    Le try et finish ne fonctionnent pas dans le visual studio....

  7. #27
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 071
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 071
    Points : 12 116
    Points
    12 116
    Par défaut
    à remplacer par
    Si cela ne vous a pas sauté aux yeux en lisant la documentation, commencez par lire un tutoriel sur C++/CLI ou tout autre langage .NET.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    while ( line = sr->ReadLine() );
    C'est quoi cette boucle qui ne fait que lire sans rien faire d'autre ?
    C'est pas plutôt ça :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    int i=0;
    while ( line = sr->ReadLine() )
    {
    i+=line->Length;
    }
    Ne jamais développer quand on est fatigué, c'est presque aussi dangereux que conduire.

    Le try et finish ne fonctionnent pas dans le visual studio....
    Vous n'auriez pas oublié de transformer le projet C++ standard en projet C++/CLI, par hazard.
    Voir un tutoriel pour C++/CLI

    Moralité, ne jamais développer sans avoir lu les tutoriels nécessaires, ne jamais développer quand on est fatigué, toujours penser que le problème est entre la chaise et l'écran quand la documentation MSDN est fausse (je n'ai que (~)2 contre-exemples en plus de 12 ans de carrière)

  8. #28
    Membre du Club
    Inscrit en
    Novembre 2008
    Messages
    81
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 81
    Points : 54
    Points
    54
    Par défaut
    Salut

    Là je suis en phase de finalisation du mon projet et il ne me reste qu'une seule information à récupérer et afficher qui la taille du fichier, j'ai essayé ce code:


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) { textBox1->Text = openFileDialog1->FileName;
    				 StreamReader^ sr = gcnew StreamReader(openFileDialog1->FileName);
    				 System::IO::FileInfo^ fi1 = gcnew System::IO::FileInfo(openFileDialog1->FileName);
    			    				 textBox2->Text= (Convert::ToString(GetFileSize(openFileDialog1->FileName)));
    Mais il m'affiche un problème d'erreur:
    GetFileSize: identificateur inconnu
    Comment puis je réglé ce problème merci d'avance

  9. #29
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 071
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 071
    Points : 12 116
    Points
    12 116
    Par défaut
    GetFileSize est une fonction Win32
    http://msdn.microsoft.com/en-us/libr...55(VS.85).aspx

    La signature ne colle pas avec ton appel et, moi, j'ai la fâcheuse habitude de mettre toujours un "::" devant toutes les fonctions Win32 quand je fais du C++ (pas forcément C++/CLI)

    Donc le plus simple est (très simple)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    textBox2->Text= fi1->Length;
    ou
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    textBox2->Text= (Convert::ToString(fi1->Length));

  10. #30
    Membre du Club
    Inscrit en
    Novembre 2008
    Messages
    81
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 81
    Points : 54
    Points
    54
    Par défaut
    Salut,

    Merci beaucoup et c'est en effet simple

  11. #31
    Membre du Club
    Inscrit en
    Novembre 2008
    Messages
    81
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 81
    Points : 54
    Points
    54
    Par défaut
    Bonjour
    Le projet est terminé, je n'ai pas ajouté grande chose, je vous passe le code peut être que quelqu'un en aura besoin un jour
    Merci pour votre aide le long de mon projet

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    #pragma once
     
     
    namespace statistiques {
     
    	using namespace System;
    	using namespace System::ComponentModel;
    	using namespace System::Collections;
    	using namespace System::Windows::Forms;
    	using namespace System::Data;
    	using namespace System::Drawing;
    	using namespace System::IO;
    	using namespace System::Text;
    	/// <summary>
    	/// Description résumée de Form1
    	///
    	/// AVERTISSEMENT*: si vous modifiez le nom de cette classe, vous devrez modifier la
    	///          propriété 'Nom du fichier de ressources' de l'outil de compilation de ressource managée
    	///          pour tous les fichiers .resx dont dépend cette classe. Dans le cas contraire,
    	///          les concepteurs ne pourront pas interagir correctement avec les ressources
    	///          localisées associées à ce formulaire.
    	/// </summary>
    	public ref class Form1 : public System::Windows::Forms::Form
    	{
    	public:
    		Form1(void)
    		{
    			InitializeComponent();
    			//
    			//TODO*: ajoutez ici le code du constructeur
    			//
    		}
     
    	protected:
    		/// <summary>
    		/// Nettoyage des ressources utilisées.
    		/// </summary>
    		~Form1()
    		{
    			if (components)
    			{
    				delete components;
    			}
    		}
    	private: System::Windows::Forms::Button^  button1;
    	protected: 
    	private: System::Windows::Forms::OpenFileDialog^  openFileDialog1;
    	private: System::Windows::Forms::TextBox^  textBox1;
    	private: System::Windows::Forms::MenuStrip^  menuStrip1;
    	private: System::Windows::Forms::ToolStripMenuItem^  fichierToolStripMenuItem;
    	private: System::Windows::Forms::ToolStripMenuItem^  quitterToolStripMenuItem;
    	private: System::Windows::Forms::ToolStripMenuItem^  toolStripMenuItem1;
    	private: System::Windows::Forms::ToolStripMenuItem^  aProposToolStripMenuItem;
    	private: System::Windows::Forms::Button^  button2;
    	private: System::Windows::Forms::TextBox^  textBox2;
    	private: System::Windows::Forms::Label^  label1;
    	private: System::Windows::Forms::TextBox^  textBox3;
    	private: System::Windows::Forms::Label^  label2;
    	private: System::Windows::Forms::TextBox^  textBox4;
    	private: System::Windows::Forms::Label^  label3;
    	private: System::Windows::Forms::TextBox^  textBox5;
    	private: System::Windows::Forms::Label^  label4;
    	private: System::Windows::Forms::TextBox^  textBox6;
    	private: System::Windows::Forms::Label^  label5;
    	private: System::Windows::Forms::TextBox^  textBox7;
    	private: System::Windows::Forms::Label^  label6;
    	private: System::Windows::Forms::TextBox^  textBox8;
    	private: System::Windows::Forms::Label^  label7;
     
     
    	private: System::Windows::Forms::TextBox^  textBox10;
    	private: System::Windows::Forms::Label^  label9;
    	private: System::Windows::Forms::ToolStripMenuItem^  ovrirToolStripMenuItem;
    	private: System::Windows::Forms::ToolTip^  toolTip1;
    	private: System::Windows::Forms::ToolStripMenuItem^  aideToolStripMenuItem;
     
     
     
     
    	private: System::ComponentModel::IContainer^  components;
     
     
     
     
    	private:
    		/// <summary>
    		/// Variable nécessaire au concepteur.
    		/// </summary>
     
     
    #pragma region Windows Form Designer generated code
    		/// <summary>
    		/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
    		/// le contenu de cette méthode avec l'éditeur de code.
    		/// </summary>
    		void InitializeComponent(void)
    		{
    			this->components = (gcnew System::ComponentModel::Container());
    			this->button1 = (gcnew System::Windows::Forms::Button());
    			this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
    			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
    			this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
    			this->fichierToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->ovrirToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->quitterToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->toolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->aideToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->aProposToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->button2 = (gcnew System::Windows::Forms::Button());
    			this->textBox2 = (gcnew System::Windows::Forms::TextBox());
    			this->label1 = (gcnew System::Windows::Forms::Label());
    			this->textBox3 = (gcnew System::Windows::Forms::TextBox());
    			this->label2 = (gcnew System::Windows::Forms::Label());
    			this->textBox4 = (gcnew System::Windows::Forms::TextBox());
    			this->label3 = (gcnew System::Windows::Forms::Label());
    			this->textBox5 = (gcnew System::Windows::Forms::TextBox());
    			this->label4 = (gcnew System::Windows::Forms::Label());
    			this->textBox6 = (gcnew System::Windows::Forms::TextBox());
    			this->label5 = (gcnew System::Windows::Forms::Label());
    			this->textBox7 = (gcnew System::Windows::Forms::TextBox());
    			this->label6 = (gcnew System::Windows::Forms::Label());
    			this->textBox8 = (gcnew System::Windows::Forms::TextBox());
    			this->label7 = (gcnew System::Windows::Forms::Label());
    			this->textBox10 = (gcnew System::Windows::Forms::TextBox());
    			this->label9 = (gcnew System::Windows::Forms::Label());
    			this->toolTip1 = (gcnew System::Windows::Forms::ToolTip(this->components));
    			this->menuStrip1->SuspendLayout();
    			this->SuspendLayout();
    			// 
    			// button1
    			// 
    			this->button1->Location = System::Drawing::Point(195, 366);
    			this->button1->Name = L"button1";
    			this->button1->Size = System::Drawing::Size(109, 28);
    			this->button1->TabIndex = 0;
    			this->button1->Text = L"Ouvrir";
    			this->toolTip1->SetToolTip(this->button1, L"Cliquer pour séléctionner le fichier");
    			this->button1->UseVisualStyleBackColor = true;
    			this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
    			// 
    			// openFileDialog1
    			// 
    			this->openFileDialog1->FileOk += gcnew System::ComponentModel::CancelEventHandler(this, &Form1::openFileDialog1_FileOk);
    			// 
    			// textBox1
    			// 
    			this->textBox1->Location = System::Drawing::Point(4, 371);
    			this->textBox1->Name = L"textBox1";
    			this->textBox1->Size = System::Drawing::Size(179, 20);
    			this->textBox1->TabIndex = 1;
    			this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
    			// 
    			// menuStrip1
    			// 
    			this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->fichierToolStripMenuItem, 
    				this->toolStripMenuItem1});
    			this->menuStrip1->Location = System::Drawing::Point(0, 0);
    			this->menuStrip1->Name = L"menuStrip1";
    			this->menuStrip1->Size = System::Drawing::Size(316, 24);
    			this->menuStrip1->TabIndex = 2;
    			this->menuStrip1->Text = L"menuStrip1";
    			// 
    			// fichierToolStripMenuItem
    			// 
    			this->fichierToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->ovrirToolStripMenuItem, 
    				this->quitterToolStripMenuItem});
    			this->fichierToolStripMenuItem->Name = L"fichierToolStripMenuItem";
    			this->fichierToolStripMenuItem->Size = System::Drawing::Size(54, 20);
    			this->fichierToolStripMenuItem->Text = L"Fichier";
    			this->fichierToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::fichierToolStripMenuItem_Click);
    			// 
    			// ovrirToolStripMenuItem
    			// 
    			this->ovrirToolStripMenuItem->Name = L"ovrirToolStripMenuItem";
    			this->ovrirToolStripMenuItem->Size = System::Drawing::Size(111, 22);
    			this->ovrirToolStripMenuItem->Text = L"Ovrir";
    			this->ovrirToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::ovrirToolStripMenuItem_Click);
    			// 
    			// quitterToolStripMenuItem
    			// 
    			this->quitterToolStripMenuItem->Name = L"quitterToolStripMenuItem";
    			this->quitterToolStripMenuItem->Size = System::Drawing::Size(111, 22);
    			this->quitterToolStripMenuItem->Text = L"Quitter";
    			this->quitterToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::quitterToolStripMenuItem_Click);
    			// 
    			// toolStripMenuItem1
    			// 
    			this->toolStripMenuItem1->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->aideToolStripMenuItem, 
    				this->aProposToolStripMenuItem});
    			this->toolStripMenuItem1->Name = L"toolStripMenuItem1";
    			this->toolStripMenuItem1->Size = System::Drawing::Size(24, 20);
    			this->toolStripMenuItem1->Text = L"\?";
    			// 
    			// aideToolStripMenuItem
    			// 
    			this->aideToolStripMenuItem->Name = L"aideToolStripMenuItem";
    			this->aideToolStripMenuItem->Size = System::Drawing::Size(122, 22);
    			this->aideToolStripMenuItem->Text = L"Aide";
    			this->aideToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::aideToolStripMenuItem_Click);
    			// 
    			// aProposToolStripMenuItem
    			// 
    			this->aProposToolStripMenuItem->Name = L"aProposToolStripMenuItem";
    			this->aProposToolStripMenuItem->Size = System::Drawing::Size(122, 22);
    			this->aProposToolStripMenuItem->Text = L"A propos";
    			this->aProposToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::aProposToolStripMenuItem_Click);
    			// 
    			// button2
    			// 
    			this->button2->Location = System::Drawing::Point(110, 400);
    			this->button2->Name = L"button2";
    			this->button2->Size = System::Drawing::Size(85, 33);
    			this->button2->TabIndex = 3;
    			this->button2->Text = L"Traiter";
    			this->toolTip1->SetToolTip(this->button2, L"Cliquer pour afficher les différentes caractéristiques du fichier");
    			this->button2->UseVisualStyleBackColor = true;
    			this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
    			// 
    			// textBox2
    			// 
    			this->textBox2->Location = System::Drawing::Point(188, 38);
    			this->textBox2->Name = L"textBox2";
    			this->textBox2->Size = System::Drawing::Size(116, 20);
    			this->textBox2->TabIndex = 4;
    			this->textBox2->TextChanged += gcnew System::EventHandler(this, &Form1::textBox2_TextChanged);
    			// 
    			// label1
    			// 
    			this->label1->AutoSize = true;
    			this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->label1->Location = System::Drawing::Point(3, 39);
    			this->label1->Name = L"label1";
    			this->label1->Size = System::Drawing::Size(110, 16);
    			this->label1->TabIndex = 5;
    			this->label1->Text = L"Date de création ";
    			this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click);
    			// 
    			// textBox3
    			// 
    			this->textBox3->Location = System::Drawing::Point(188, 102);
    			this->textBox3->Name = L"textBox3";
    			this->textBox3->Size = System::Drawing::Size(116, 20);
    			this->textBox3->TabIndex = 6;
    			// 
    			// label2
    			// 
    			this->label2->AutoSize = true;
    			this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->label2->Location = System::Drawing::Point(3, 103);
    			this->label2->Name = L"label2";
    			this->label2->Size = System::Drawing::Size(143, 16);
    			this->label2->TabIndex = 7;
    			this->label2->Text = L"Nombre de caractères";
    			this->label2->Click += gcnew System::EventHandler(this, &Form1::label2_Click);
    			// 
    			// textBox4
    			// 
    			this->textBox4->Location = System::Drawing::Point(188, 140);
    			this->textBox4->Name = L"textBox4";
    			this->textBox4->Size = System::Drawing::Size(117, 20);
    			this->textBox4->TabIndex = 8;
    			this->textBox4->TextChanged += gcnew System::EventHandler(this, &Form1::textBox4_TextChanged);
    			// 
    			// label3
    			// 
    			this->label3->AutoSize = true;
    			this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->label3->Location = System::Drawing::Point(3, 141);
    			this->label3->Name = L"label3";
    			this->label3->Size = System::Drawing::Size(130, 16);
    			this->label3->TabIndex = 9;
    			this->label3->Text = L"Nombre de voyelles";
    			// 
    			// textBox5
    			// 
    			this->textBox5->Location = System::Drawing::Point(188, 176);
    			this->textBox5->Name = L"textBox5";
    			this->textBox5->Size = System::Drawing::Size(117, 20);
    			this->textBox5->TabIndex = 10;
    			this->textBox5->TextChanged += gcnew System::EventHandler(this, &Form1::textBox5_TextChanged);
    			// 
    			// label4
    			// 
    			this->label4->AutoSize = true;
    			this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->label4->Location = System::Drawing::Point(3, 176);
    			this->label4->Name = L"label4";
    			this->label4->Size = System::Drawing::Size(145, 16);
    			this->label4->TabIndex = 11;
    			this->label4->Text = L"Nombre de consonnes";
    			// 
    			// textBox6
    			// 
    			this->textBox6->Location = System::Drawing::Point(187, 213);
    			this->textBox6->Name = L"textBox6";
    			this->textBox6->Size = System::Drawing::Size(118, 20);
    			this->textBox6->TabIndex = 12;
    			this->textBox6->TextChanged += gcnew System::EventHandler(this, &Form1::textBox6_TextChanged);
    			// 
    			// label5
    			// 
    			this->label5->AutoSize = true;
    			this->label5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->label5->Location = System::Drawing::Point(3, 214);
    			this->label5->Name = L"label5";
    			this->label5->Size = System::Drawing::Size(124, 16);
    			this->label5->TabIndex = 13;
    			this->label5->Text = L"Nombre d\'espaces";
    			// 
    			// textBox7
    			// 
    			this->textBox7->Location = System::Drawing::Point(188, 248);
    			this->textBox7->Name = L"textBox7";
    			this->textBox7->Size = System::Drawing::Size(117, 20);
    			this->textBox7->TabIndex = 14;
    			this->textBox7->TextChanged += gcnew System::EventHandler(this, &Form1::textBox7_TextChanged);
    			// 
    			// label6
    			// 
    			this->label6->AutoSize = true;
    			this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->label6->Location = System::Drawing::Point(3, 249);
    			this->label6->Name = L"label6";
    			this->label6->Size = System::Drawing::Size(147, 16);
    			this->label6->TabIndex = 15;
    			this->label6->Text = L"Nombre de majuscules";
    			// 
    			// textBox8
    			// 
    			this->textBox8->Location = System::Drawing::Point(188, 283);
    			this->textBox8->Name = L"textBox8";
    			this->textBox8->Size = System::Drawing::Size(117, 20);
    			this->textBox8->TabIndex = 16;
    			// 
    			// label7
    			// 
    			this->label7->AutoSize = true;
    			this->label7->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->label7->Location = System::Drawing::Point(1, 284);
    			this->label7->Name = L"label7";
    			this->label7->Size = System::Drawing::Size(121, 16);
    			this->label7->TabIndex = 17;
    			this->label7->Text = L"Nombre de chiffres";
    			// 
    			// textBox10
    			// 
    			this->textBox10->Location = System::Drawing::Point(188, 64);
    			this->textBox10->Name = L"textBox10";
    			this->textBox10->Size = System::Drawing::Size(116, 20);
    			this->textBox10->TabIndex = 20;
    			this->textBox10->TextChanged += gcnew System::EventHandler(this, &Form1::textBox10_TextChanged);
    			// 
    			// label9
    			// 
    			this->label9->AutoSize = true;
    			this->label9->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->label9->Location = System::Drawing::Point(3, 65);
    			this->label9->Name = L"label9";
    			this->label9->Size = System::Drawing::Size(158, 16);
    			this->label9->TabIndex = 21;
    			this->label9->Text = L"Taille du fichier (en Octet)";
    			// 
    			// toolTip1
    			// 
    			this->toolTip1->Popup += gcnew System::Windows::Forms::PopupEventHandler(this, &Form1::toolTip1_Popup);
    			// 
    			// Form1
    			// 
    			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
    			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    			this->ClientSize = System::Drawing::Size(316, 445);
    			this->Controls->Add(this->label9);
    			this->Controls->Add(this->textBox10);
    			this->Controls->Add(this->label7);
    			this->Controls->Add(this->textBox8);
    			this->Controls->Add(this->label6);
    			this->Controls->Add(this->textBox7);
    			this->Controls->Add(this->label5);
    			this->Controls->Add(this->textBox6);
    			this->Controls->Add(this->label4);
    			this->Controls->Add(this->textBox5);
    			this->Controls->Add(this->label3);
    			this->Controls->Add(this->textBox4);
    			this->Controls->Add(this->label2);
    			this->Controls->Add(this->textBox3);
    			this->Controls->Add(this->label1);
    			this->Controls->Add(this->textBox2);
    			this->Controls->Add(this->button2);
    			this->Controls->Add(this->textBox1);
    			this->Controls->Add(this->button1);
    			this->Controls->Add(this->menuStrip1);
    			this->MainMenuStrip = this->menuStrip1;
    			this->Name = L"Form1";
    			this->Text = L"Statistiques";
    			this->menuStrip1->ResumeLayout(false);
    			this->menuStrip1->PerformLayout();
    			this->ResumeLayout(false);
    			this->PerformLayout();
     
    		}
    #pragma endregion
     
    	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
    				 openFileDialog1->InitialDirectory = "c:\\";
    				 openFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; 
    				 openFileDialog1->ShowDialog();
    				 textBox1-> Text= (openFileDialog1->FileName);
     
    			 }
    	private: System::Void openFileDialog1_FileOk(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
    			 }
    	private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    				  }
     
    private: System::Void fichierToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
    			 }
    private: System::Void quitterToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
    			 Form1::Close(); }
    private: System::Void aProposToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
    			 MessageBox::Show("© Copyright to Marouane");		 }
    private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) { 
     
    			 if (openFileDialog1->FileName=="")
    			 {MessageBox::Show("Oups... Veuillez séléctionner un fichier");
    			 return;}
     
     
    			     StreamReader^ sr = gcnew StreamReader(openFileDialog1->FileName);
    				 System::IO::FileInfo^ fi1 = gcnew System::IO::FileInfo(openFileDialog1->FileName);
     
    				 textBox2->Text= (Convert::ToString(fi1->CreationTime));
    				 textBox10->Text= (Convert::ToString(fi1->Length));
    				 int nbcaractere=0;
    				 int nbvoyelle=0;
    				 int nbconsonne=0;
    				 int nbespace=0;
    				 int nbmajuscule=0;
    				 int nbchiffre=0;
    				 char v;
     
    				 {
     
     
     
     
    		 {
    				while (sr->Peek()>=0)
    				{	nbcaractere+=1;
    					v=(char)sr->Read();
    					if (v==('\n'))
    						nbcaractere-=2;
    					if (v==(' '))
    						nbcaractere-=1;
    					if ((v=='a')| (v=='e') | (v=='i') | (v=='o') | (v=='u') | (v=='y')|(v=='A')|(v=='E')|(v=='Y')|(v=='U')|(v=='I')|(v=='O'))
    						nbvoyelle+=1;
    					if ((v=='z')|(v=='r')|(v=='t')|(v=='p')|(v=='q')|(v=='s')|(v=='d')|(v=='f')|(v=='g')|(v=='h')|(v=='j')|(v=='k')|(v=='l')|(v=='m')|(v=='w')|(v=='x')|(v=='c')|(v=='v')|(v=='b')|(v=='n')|(v=='Z')|(v=='R')|(v=='T')|(v=='P')|(v=='M')|(v=='L')|(v=='K')|(v=='J')|(v=='H')|(v=='G')|(v=='F')|(v=='D')|(v=='S')|(v=='Q')|(v=='W')|(v=='X')|(v=='C')|(v=='V')|(v=='B')|(v=='N'))
    						nbconsonne+=1;
    					if (v==' ')
    						nbespace+=1;
    					if ( (((int)v)>=65) && (((int)v)<=90)) 
    						nbmajuscule+=1;
    					if ((v=='0')|(v=='1')|(v=='2')|(v=='3')|(v=='4')|(v=='5')|(v=='6')|(v=='7')|(v=='8')|(v=='9'))
    						nbchiffre+=1;
     
     
    				}
     
    				}
     
     
          }
    	  textBox3->Text::set(Convert::ToString(nbcaractere));
    	  textBox4->Text::set(Convert::ToString(nbvoyelle));
    	  textBox5->Text::set(Convert::ToString(nbconsonne));
    	  textBox6->Text::set(Convert::ToString(nbespace));		
    	  textBox7->Text::set(Convert::ToString(nbmajuscule));	 
    	  textBox8->Text::set(Convert::ToString(nbchiffre));	 
     
    		 }
    private: System::Void textBox2_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    		     }
    private: System::Void label1_Click(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void label2_Click(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void textBox5_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void textBox6_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void textBox4_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    		 }
     
    private: System::Void textBox10_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void textBox9_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void ovrirToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
    			 openFileDialog1->InitialDirectory = "c:\\";
    				 openFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; 
    				 openFileDialog1->ShowDialog();
    				textBox1-> Text= (openFileDialog1->FileName);
    		 }
     
     
    private: System::Void toolTip1_Popup(System::Object^  sender, System::Windows::Forms::PopupEventArgs^  e) {
     
     
     
    		 }
    private: System::Void aideToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
    			 MessageBox::Show("1. Cliquer sur le bouton Ouvrir pour séléctionner un fichier \n2. Cliquer sur le bouton Traiter pour afficher les différentes caractéristiques du fichier séléctionné");
    		 }
    private: System::Void textBox7_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    		 }
    }

+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 2 PremièrePremière 12

Discussions similaires

  1. [VBA-E] Macro pour convertir un fichier texte en excel
    Par Nicolas67 dans le forum Macros et VBA Excel
    Réponses: 5
    Dernier message: 15/05/2006, 14h47
  2. comment utiliser Notepad pour modifier un fichier texte?
    Par moon13_698 dans le forum Autres Logiciels
    Réponses: 7
    Dernier message: 06/05/2006, 15h41
  3. Pb pour importer un fichier texte
    Par sam01 dans le forum Requêtes
    Réponses: 2
    Dernier message: 29/09/2005, 13h16
  4. Un programme "p2p" pour échanger des fichiers text
    Par Cthulhu 22 dans le forum Développement
    Réponses: 2
    Dernier message: 17/02/2005, 15h51
  5. Instruction pour créer un fichier text ???
    Par Soulsurfer dans le forum Langage
    Réponses: 2
    Dernier message: 06/08/2002, 11h17

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo