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
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include "eth_lib.h"
statsMacDestination(char* mac){
FILE *pointeurFichier;
pointeurFichier = fopen("statMacDestination.txt", "rw");
//ecriture dans le fichier
//fin écriture
exit(0);
}
main(){
statsMacDestination("fffffffff");
/*******************************************
Declaration des variables
********************************************/
int i; //compteur
char ch[50];
char* temp;
int numeroTrame = 1;
int nb; //nombre d'octets dans la trame
char* _destination;
char* _emission;
char* _type;
while(1){
i = 0;
//static struct eth_frame;
/*******************************************
DEBUT Affichage des informations de trames
********************************************/
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
printf("TRAME N %d\n",numeroTrame);
fscanf(stdin,"%s",&ch);
// printf("\n Introduction : %s", ch);
fscanf(stdin,"%s",&ch);
// printf("\n ma frame : %s", ch);
fscanf(stdin, "%d",&nb);
printf("\n nombre d'octets : %d \n",nb);
printf("\n Adresse de destination :");
for(i; i<=5; i++){
fscanf(stdin, "%s",&temp);
printf("%s",&temp);
_destination = temp;
}
printf("\n Adresse de l'emetteur :");
for(i; i<=11; i++){
fscanf(stdin, "%s",&temp);
printf("%s",&temp);
_emission = &temp;
}
printf("\n Type de la donnee :");
for(i; i<=13; i++){
fscanf(stdin, "%s",&temp);
printf("%s",&temp);
_type = &temp;
}
printf("\n donnee :");
while (i != nb){
fscanf(stdin, "%s",&temp);
printf(" %s",&temp);
i++;
}
/*******************************************
FIN Affichage des informations de trames
********************************************/
numeroTrame++;
/*******************************************
DEBUT Ecriture Statistiques
********************************************/
statsMacDestination(_destination);
statsMacEmission(_emission);
statsMacTypeDonnees(_type);
/*******************************************
FIN Ecriture Statistiques
********************************************/
printf("\n\n");
}
printf("Fin de fichier atteinte \n");
} |
Partager