Bonjour à vous développeurs,

Je suis toute nouvelle dans le monde du C et j'avoue avoir bien du mal à m'en sortir...

Je suis actuellement sur un projet de Mini Chat...

Pour ce faire, j'ai à ma disposition un sniffer pour lequel j'ai fait un parseur. A ce dernier, j'aimerai rajouter un module de statistiques.

Le problème étant que je souhaiterai le faire avec des fichiers plutôt que des tableaux. Et mes pauvres notions sur les pointeurs doivent être la cause de mon échec...

Je me suis renseignée dessus mais j'ai du mal à saisir réellement comment ca marche

Voici mon code actuel :
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
 
#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");
}
Les erreurs m'étant renvoyées sous GCC (ubuntu) sont les suivantes :
main.c: Dans la fonction «main» :
main.c:57: attention : assignment from incompatible pointer type
main.c:64: attention : assignment from incompatible pointer type
main.c:71: attention : assignment from incompatible pointer type
/tmp/ccUW0R94.o: In function `main':
main.c.text+0x231): undefined reference to `statsMacEmission'
main.c.text+0x23c): undefined reference to `statsMacTypeDonnees'
collect2: ld a retourné 1 code d'état d'exécution
Pour information, le retour d'une trame par le sniffer est de forme :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
Byte rcv:
42
ff ff ff ff ff ff 00 b0 d0 31 f1 46 08 06 00 01 
08 00 06 04 00 01 00 b0 d0 31 f1 46 c0 a8 0a 04 
00 00 00 00 00 00 c0 a8 0a fe