Please help me somebody how to put integer into file. In variable 'mnozenje' I have the right numbers but in the file 'Weights.txt' I have this ĂĂĂȂāāĀ.With printf("%d",mnozenje); in the console the numbers are correct.  I will copy all my code:
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
int _tmain(int argc, _TCHAR* argv[])
{
        FILE *train, *weights,*test ;
        char ch ;
        train = fopen ( "Train.txt", "r" ) ;
        if ( train == NULL )
        {
               puts ( "Cannot open source file" ) ;
               return 0 ;
        }
        test = fopen ( "Test.txt", "r" ) ;
        if ( test == NULL )
        {
               puts ( "Cannot open source file" ) ;
               return 0 ;
        }
        weights = fopen ( "Weights.txt", "w" ) ;
        if ( weights == NULL )
        {
               puts ( "Cannot open target file" ) ;
               fclose ( weights ) ;
               return 0 ;
        }
        int i=0,vektori=0,nevroni=0;
        while ( i<=3 )
        {
                i++;
                ch = fgetc ( train ) ;
                if ( ch == EOF )
                       break ;
                else
                {
                    if(i==1)
                        vektori=atoi(&ch);
                    if(i==3)
                        nevroni=atoi(&ch);
                }
        }
        int x=1,y=1,a[100][100],w[100][100];
        char c;
        while(1)
        {
            ch = fgetc ( train ) ;
            if ( ch == EOF )
                break ;
                if(ch!=10)
                {
                    a[x][y]=atoi(&ch);
                    if(y==nevroni)
                    {
                        x++;
                        y=0;
                    }
                    y++;
                }
        }
        int pomos=1,mnozenje=0,s;
        for(int k=1;k<=nevroni;k++)
        {
            for(int l=1;l<=nevroni;l++)
            {
                if(k!=l)
                {
                    while(pomos<=vektori)
                    {
                        mnozenje+=a[pomos][k]*a[pomos][l];
                        pomos++;
                    }
                    printf("%d",mnozenje);
                    w[k][l]=mnozenje;
                    c=(char)mnozenje;
________________________________________________________________
                    fputc ( mnozenje, weights )  ;//here is the problem
________________________________________________________________
                    mnozenje=0;
                    pomos=1;
                }
            }
        }
        fclose (train) ;
        fclose (weights);
        fclose (test);
                    scanf("%d",s);
    return 0;
}