Comment est-ce que je peux faire ?
Améliorez votre expérience CodeS-SourceS avec ce plugin:
http://codes-sources.commentcamarche.net/forum/affich-10000111-plugin-better-cs-2#cptpingu-signature
#include <stdlib.h> #include <stdio.h> #define TAILLE_MAX 1000 int main(int argc, char *argv[]) { FILE* fichier = NULL; int compteur; char chaine[TAILLE_MAX] = ""; char action[TAILLE_MAX] = ""; char id_med[TAILLE_MAX] = ""; char user[TAILLE_MAX] = ""; char code_labo[TAILLE_MAX] = ""; char open[TAILLE_MAX] = ""; fichier = fopen("c:\\etilab\\import\\CBLEtilab.ini", "r"); compteur = -1; if (fichier != NULL) { while (fgets(chaine, TAILLE_MAX, fichier) != NULL) // On lit le fichier tant qu'on ne reçoit pas d'erreur (NULL) { ++compteur; //* printf("%s", chaine); // On affiche la chaîne qu'on vient de lire if (compteur == 0) { strcpy(action, chaine); //* printf("A : %s", action); } if (compteur == 1) { strcpy(id_med, chaine); //* printf("I : %s", id_med); //* printf("C : %s", chaine); } if (compteur == 2) { strcpy(user, chaine); //* printf("U : %s", user); //* printf("C : %s", chaine); } if (compteur == 3) { strcpy(code_labo, chaine); //* printf("O : %s", code_labo); //* printf("C : %s", chaine); } if (compteur == 4) { strcpy(open, chaine); //* printf("P : %s", open); //* printf("C : %s", chaine); } } printf("A : %s", action); printf("I : %s", id_med); printf("U : %s", user); printf("O : %s", code_labo); printf("P : %s", open); fclose(fichier); } return 0; }
#include <stdlib.h> #include <stdio.h> #define TAILLE_MAX 1000 int main(int argc, char *argv[]) { FILE* fichier = NULL; int compteur; int v; char Explorer[TAILLE_MAX] = ""; char ExplorerAdd[TAILLE_MAX] = "&"; char Explorer1[TAILLE_MAX] = "https://www.proxilis.ch/directlab/link_doc.php?"; char ExplorerNum[TAILLE_MAX] = "num="; char ExplorerNom[TAILLE_MAX] = "nom="; char ExplorerPreNom[TAILLE_MAX] = "prenom="; char ExplorerSexe[TAILLE_MAX] = "sexe="; char ExplorerNaissance[TAILLE_MAX] = "naissance="; char ExplorerAdresse[TAILLE_MAX] = "adresse="; char ExplorerCP[TAILLE_MAX] = "cp="; char ExplorerVille[TAILLE_MAX] = "ville="; char ExplorerPays[TAILLE_MAX] = "pays="; char ExplorerTel[TAILLE_MAX] = "tel="; char ExplorerMobile[TAILLE_MAX] = "mobile="; char ExplorerEmail[TAILLE_MAX] = "email="; char action[TAILLE_MAX] = ""; char id_med[TAILLE_MAX] = ""; char user[TAILLE_MAX] = ""; char code_labo[TAILLE_MAX] = ""; char open[TAILLE_MAX] = ""; char chaine[TAILLE_MAX] = ""; char chaineT[TAILLE_MAX] = ""; char num[TAILLE_MAX] = ""; char nom[TAILLE_MAX] = ""; char prenom[TAILLE_MAX] = ""; char sexe[TAILLE_MAX] = ""; char sexenum[TAILLE_MAX] = ""; char naissance[TAILLE_MAX] = ""; char jjnaissance[2] = ""; char mmnaissance[2] = ""; char aanaissance[2] = ""; char adresse[TAILLE_MAX] = ""; char cp[TAILLE_MAX] = ""; char ville[TAILLE_MAX] = ""; char pays[TAILLE_MAX] = ""; char tel[TAILLE_MAX] = ""; char mobile[TAILLE_MAX] = ""; char email[TAILLE_MAX] = ""; char Reseau[TAILLE_MAX] = ""; char *ptr = ""; char *ptr3000; char *ptr3101; char *ptr3102; char *ptr3103; char *ptr3106; char *ptr3107; char *ptr3110; char *str1 = ""; char *str2 = "3000"; char *str3000 = "3000"; char *str3101 = "3101"; char *str3102 = "3102"; char *str3103 = "3103"; char *str3106 = "3106"; char *str3107 = "3107"; char *str3110 = "3110"; char *resultat3000 = ""; char *sexefille = "2"; char *sexegarcon = "1"; char *new_s = NULL; char *new_ville = NULL; char *new_cp = NULL; char *new_jj = NULL; char *new_mm = NULL; char *new_aa = NULL; unsigned int start; unsigned int end; /* Ouverture du fichier CBLEtilab.ini */ fichier = fopen("c:\\etilab\\import\\CBLEtilab.ini", "r"); compteur = -1; if (fichier != NULL) { while (fgets(chaine, TAILLE_MAX, fichier) != NULL) // On lit le fichier tant qu'on ne reçoit pas d'erreur (NULL) { ++compteur; //* printf("%s", chaine); // On affiche la chaîne qu'on vient de lire if (compteur == 0) { strcpy(action, chaine); //* printf("A : %s", action); } if (compteur == 1) { strcpy(id_med, chaine); //* printf("I : %s", id_med); //* printf("C : %s", chaine); } if (compteur == 2) { strcpy(user, chaine); //* printf("U : %s", user); //* printf("C : %s", chaine); } if (compteur == 3) { strcpy(code_labo, chaine); //* printf("O : %s", code_labo); //* printf("C : %s", chaine); } if (compteur == 4) { strcpy(open, chaine); //* printf("P : %s", open); //* printf("C : %s", chaine); } } printf("%s", action); printf("%s", id_med); printf("%s", user); printf("%s", code_labo); printf("%s", open); /* Fermeture du fichier */ fclose(fichier); } /* Ouverture du fichier GDTEtilab.GDT */ fichier = fopen("c:\\etilab\\import\\GDTEtilab.GDT", "r"); compteur = -1; if (fichier != NULL) { while (fgets(chaine, TAILLE_MAX, fichier) != NULL) // On lit le fichier tant qu'on ne reçoit pas d'erreur (NULL) { ++compteur; //* printf("%s", chaine); // On affiche la chaîne qu'on vient de lire strcpy(str1, chaine); //* printf("%s", str1); /* CHAINE */ new_s = NULL; start = 7; end = 100; if (chaine != NULL && start < end) { /* (1)*/ new_s = malloc (sizeof (*new_s) * (end - start + 2)); if (new_s != NULL) { int i; /* (2) */ for (i = start; i <= end; i++) { /* (3) */ new_s[i-start] = chaine[i]; } new_s[i-start] = '\0'; } else { fprintf (stderr, "Memoire insuffisante\n"); exit (EXIT_FAILURE); } } //* printf("%s\n", new_s); /* VILLE */ new_ville = NULL; start = 12; end = 100; if (chaine != NULL && start < end) { /* (1)*/ new_ville = malloc (sizeof (*new_ville) * (end - start + 2)); if (new_ville != NULL) { int i; /* (2) */ for (i = start; i <= end; i++) { /* (3) */ new_ville[i-start] = chaine[i]; } new_ville[i-start] = '\0'; } else { fprintf (stderr, "Memoire insuffisante\n"); exit (EXIT_FAILURE); } } /* CP */ new_cp = NULL; start = 7; end = 10; if (chaine != NULL && start < end) { /* (1)*/ new_cp = malloc (sizeof (*new_cp) * (end - start + 2)); if (new_cp != NULL) { int i; /* (2) */ for (i = start; i <= end; i++) { /* (3) */ new_cp[i-start] = chaine[i]; } new_cp[i-start] = '\0'; } else { fprintf (stderr, "Memoire insuffisante\n"); exit (EXIT_FAILURE); } } //* printf("CP : %s\n", new_cp); /* JJNAISSANCE */ new_jj = NULL; start = 7; end = 8; if (chaine != NULL && start < end) { /* (1)*/ new_jj = malloc (sizeof (*new_jj) * (end - start + 2)); if (new_jj != NULL) { int i; /* (2) */ for (i = start; i <= end; i++) { /* (3) */ new_jj[i-start] = chaine[i]; } new_jj[i-start] = '\0'; } else { fprintf (stderr, "Memoire insuffisante\n"); exit (EXIT_FAILURE); } } //* printf("JJ : %s\n", new_jj); /* MMNAISSANCE */ new_mm = NULL; start = 9; end = 10; if (chaine != NULL && start < end) { /* (1)*/ new_mm = malloc (sizeof (*new_mm) * (end - start + 2)); if (new_mm != NULL) { int i; /* (2) */ for (i = start; i <= end; i++) { /* (3) */ new_mm[i-start] = chaine[i]; } new_mm[i-start] = '\0'; } else { fprintf (stderr, "Memoire insuffisante\n"); exit (EXIT_FAILURE); } } //* printf("MM : %s\n", new_mm); /* AANAISSANCE */ new_aa = NULL; start = 11; end = 14; if (chaine != NULL && start < end) { /* (1)*/ new_aa = malloc (sizeof (*new_aa) * (end - start + 2)); if (new_aa != NULL) { int i; /* (2) */ for (i = start; i <= end; i++) { /* (3) */ new_aa[i-start] = chaine[i]; } new_aa[i-start] = '\0'; } else { fprintf (stderr, "Memoire insuffisante\n"); exit (EXIT_FAILURE); } } //* printf("AA : %s\n", new_aa); /* 3000 */ ptr3000 = ""; ptr3000 = strstr(str1, str3000); if (ptr3000 != NULL) { strcpy(num, new_s); } /* 3101 */ ptr3101 = ""; ptr3101 = strstr(str1, str3101); if (ptr3101 != NULL) { strcpy(nom, new_s); } /* 3102 */ ptr3102 = ""; ptr3102 = strstr(str1, str3102); if (ptr3102 != NULL) { strcpy(prenom, new_s); } /* 3103 */ ptr3103 = ""; ptr3103 = strstr(str1, str3103); if (ptr3103 != NULL) { //* strcpy(naissance, new_s); //* printf("%s\n", naissance); //* naissance = ""; strcat(naissance, new_aa); strcat(naissance, new_mm); strcat(naissance, new_jj); //* printf("Naissance : %s\n", naissance); } /* 3106 */ ptr3106 = ""; ptr3106 = strstr(str1, str3106); if (ptr3106 != NULL) { strcpy(cp, new_cp); strcpy(ville, new_ville); } /* 3107 */ ptr3107 = ""; ptr3107 = strstr(str1, str3107); if (ptr3107 != NULL) { strcpy(adresse, new_s); } /* 3110 */ ptr3110 = ""; ptr3110 = strstr(str1, str3110); if (ptr3110 != NULL) { strcpy(sexenum, new_s); v = strncmp(sexenum, sexefille, 1); if (v == 0) { strcpy(sexe, "F"); } v = strncmp(sexenum, sexegarcon, 1); if (v == 0) { strcpy(sexe, "H"); } } } printf("Num : %s", num); printf("Nom : %s", nom); printf("Prénom : %s", prenom); printf("Naissance : %s\n", naissance); printf("CP : %s\n", cp); printf("Ville : %s", ville); printf("Adresse : %s", adresse); printf("Sexe : %s\n\n", sexe); /* Fermeture du fichier */ fclose(fichier); /* URL */ strcat(Explorer, Explorer1); strcat(Explorer, action); strcat(Explorer, ExplorerAdd); strcat(Explorer, user); strcat(Explorer, ExplorerAdd); strcat(Explorer, code_labo); strcat(Explorer, ExplorerAdd); strcat(Explorer, id_med); strcat(Explorer, ExplorerAdd); strcat(Explorer, ExplorerNum); strcat(Explorer, num); strcat(Explorer, ExplorerAdd); strcat(Explorer, ExplorerNom); strcat(Explorer, nom); strcat(Explorer, ExplorerAdd); strcat(Explorer, ExplorerPreNom); strcat(Explorer, prenom); strcat(Explorer, ExplorerAdd); strcat(Explorer, ExplorerSexe); strcat(Explorer, sexe); strcat(Explorer, ExplorerAdd); strcat(Explorer, ExplorerNaissance); strcat(Explorer, naissance); strcat(Explorer, ExplorerAdd); strcat(Explorer, ExplorerAdresse); strcat(Explorer, adresse); strcat(Explorer, ExplorerAdd); strcat(Explorer, ExplorerCP); strcat(Explorer, cp); strcat(Explorer, ExplorerAdd); strcat(Explorer, ExplorerVille); strcat(Explorer, ville); strcat(Explorer, ExplorerAdd); strcat(Explorer, ExplorerPays); strcat(Explorer, pays); strcat(Explorer, ExplorerAdd); strcat(Explorer, ExplorerTel); strcat(Explorer, tel); strcat(Explorer, ExplorerAdd); strcat(Explorer, ExplorerMobile); strcat(Explorer, mobile); strcat(Explorer, ExplorerAdd); strcat(Explorer, ExplorerEmail); strcat(Explorer, email); strcat(Explorer, ExplorerAdd); strcat(Explorer, open); printf("Explorer A : %s\n", Explorer); //* Process.Start(Explorer) } return 0; }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question#include <stdlib.h> #include <stdio.h> #define TAILLE_MAX 1000 int main(int argc, char *argv[]) { FILE* fichier = NULL; int compteur; int v; char Expl[TAILLE_MAX] = "start http://www.google.ch"; char Explor[TAILLE_MAX] = "start https://www.proxilis.ch/directlab/link_doc.php?action=ADDPAT&user=125784b92703c&code_labo=0&id_med=9997&num=987654&nom=NAIMARRE&prenom=Jean&sexe=H&naissance=19101010&adresse=Route de Satigny,42&cp=1217&ville=Meyrin&pays=Suisse&tel=0223413314&mobile=0792857520&email=info@prolis.ch&open=1"; printf("Explor : %s\n", Explor); //* system("start http://www.google.ch"); system(Explor); //* Process.Start(Explorer) return 0; }