bonjour!!
voila j'ai la fonction suivante :
je lui passe en paramètre la chaine suivante :
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 char* Canonise(char* strFilePath) { if (IsValid(strFilePath) != 0) { printf("la chaine ne correpond pas à un chemin \n"); exit(-2); } char* strTmp; // Si le chemine passé en paramètre est relatif if (strFilePath[0] != '/') { // On construit un chemin absolu non épuré strTmp = GetAbsolutePath(strFilePath); } else { strTmp = strFilePath; printf("chemin = %s\n", strTmp); } char* strCan = (char*) malloc(MAX_PATH * sizeof(char)); strCan[0] = '/'; // Construction du tableau de répertoires int i, nIndex; printf("chemin = %s\n", strTmp); ....
et voici le résultat des 2 printfs :
Code : Sélectionner tout - Visualiser dans une fenêtre à part /home/hiko-seijuro/Langage-C/Projet/./include/test/../../../chemin.c
[] représente un ptit carré !!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 printf1 :chemin = /home/hiko-seijuro/Langage-C/Projet/./include/test/../../../chemin.c printf2 : chemin = /home/hiko-seijuro/Langage-C/Projet/./include/test/../../../chemin.c []
vous savez a quoi c du ?
Partager