2017-02-24 1 views
-1

csvファイルで構成されたウェブサイトのタブの最後にウェブサイトを追加する必要があります。ユーザーはすべてのフィールドを埋めることができます。0を入力すると、次のフィールドに移動します。ファイルの末尾に情報を追加する

Commune;Insee;url;Pop;https;Ser;Vserv;App;VApp;Langage;VLangag;Latitude;Longitude 
Argentat;19010;argentat.fr;3042;non;SiteW;2;Inconnue;Inconnue;php;5.3.29;45.10;1.93 
Canenx-et-Réaut;40064;mairie-info.com;175;non;SiteW;2;Inconnue;Inconnue;php;5.3.29;43.9;-0.4 
Chaussan;69051;chaussan.fr;972;non;SiteW;2;Inconnue;Inconnue;Inconnue;Inconnue;45.637;4.6340 
Étrez;1154;etrez.fr;803;non;SiteW;2;Inconnue;Inconnue;Inconnue;Inconnue;46.338;5.192 
Gray ;70279;villegray.fr;6016;non;SiteW;2;Inconnue;Inconnue;php;5.2.10;47.4322;5.6109 

それはCSVだように、各フィールドは;によって分割されています。5最初の行です 。 私の実際の表示プログラムは以下の通りです:

while (fgets(buffer, sizeof buffer, curseur)) 
{ 
    char *token = strtok(buffer, ";"); 
    printf("Line %d\n", linenumber++); 

    int column = 0; 
    while (token != NULL) 
    { 
      printf("%2d %s\n", column, token); 

      switch (column) 
      { 
      case 0:     
       strcpy((pSites + iSites)->Commune, token); 
       break; 
      case 1: 
       strcpy((pSites + iSites)->url, token); 
       break; 
      case 2: 
       strcpy((pSites + iSites)->https, token); 
       break; 
      case 3: 
       strcpy((pSites + iSites)->Serveur, token); 
       break; 
      case 4: 
       strcpy((pSites + iSites)->url, token); 
       break; 
      case 5: 
       strcpy((pSites + iSites)->Application, token); 
       break; 
      case 6: 
       strcpy((pSites + iSites)->VersionApplication, token); 
       break; 
      case 7: 
       strcpy((pSites + iSites)->Langage, token); 
       break; 
      case 8: 
       strcpy((pSites + iSites)->VersionLangage, token); 
       break; 
      } 


       token = strtok(NULL, ";"); 
       column++; 
      } 

     iSites++; 
    } 

がどのように私はこのような何か使用して、ウェブサイトのタブの最後にサイトを追加することができます:私はあなたのテキストを無視してお答えします

while (strcmp((pLivre + i)->titre, "") != 0) { 
     i++; 
    } 
    *(pLivre + i) = livreAjouter; 
+1

を参照してください。質問は...? –

+0

Oupsさん、ちょうど質問が追加されました –

+0

あなたの質問は "広すぎます"。 [How to ask](http://stackoverflow.com/help/how-to-ask)を読んで、より良い返答を得るために質問を言い直してください。 –

答えて

関連する問題