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
|
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char *enc_quotedP(char * string){
int i=0;
char *textqp;
textqp=malloc(strlen(string)+1);
fprintf(stdout,"Taille de string : %d\n",strlen(string));
if(textqp){
fprintf(stdout,"Allocation reussie \n");
fprintf(stdout,"Valeur de string+i : %c \n",*(string+i));
fprintf(stdout,"Avant boucle while \n");
while((*string)!='\0'){
fprintf(stdout,"Boucle reussie \n");
if((*(string)<0) || (strcmp((string),"=")==0)) {
sprintf((textqp+i),"=%x",(string));
}
else {
*(textqp+i)=*(string);
}
string++;
i++;
}
return textqp;
}
fprintf(stderr,"Erreur de Malloc\n");
return NULL;
}
int main (int argc, char* argv[]){
char *texte="Les accents : à é è ç";
fprintf(stdout,"Appel de la fonction \n");
char *textecoder=enc_quotedP(texte);
fprintf(stdout,"Texte : %s\n Texte encoder:%s\n",texte,textecoder);
} |
Partager