fputs array inside for (C) -


i'm trying write inside file whole content of array. here code:

   fichier = fopen(patch, "w+");  if (fichier != null) {         if(methode==1)         {             trieur(tableau, ttableau);             int d;             d=0;             (d = 0 ; d < ttableau ; d++)             {                 fputs(tableau[d], fichier);             }          }         else if(methode==2)         {             trieur2(tableau, ttableau);             int d;             d=0;             (d = 0 ; d < ttableau ; d++)             {                 fputs(tableau[d], fichier);             }          }         else         {         printf("methode non disponible!\nbye bye!");         exit(0);         }          {         caractere = fgetc(fichier);         printf("%c", caractere);     } while (caractere != eof);      fclose(fichier);  } else {     printf("hum wrong witch file %s", name); } 

but isn't working. can me?

thanks!

ps: more script, working normally, script shutting down when should write on file :/

main => pastebin.com/m2am0080 func.h => pastebin.com/kqkabwin

following link complete code, have int tableau[]. ypu pass int fputs() fputs() expects char *. cannot work. write int binarily output file use

fwrite( tableau+d, sizeof(int), 1, fichier ); 

to write number of ascii digits use

fprintf( fichier, "%d", tableau[d] ); 

btw. it's easier if include declarations of variables use in post directly.


Comments