#1
I'm trying to fill a struct that has a char variable of 5 characters, and an int character.
For some reason, it reads the char, but it doesn't read the int. It stays in 0 when I check with the WATCH. Any idea?
while (scanf("%d",fin))
	    {
	    fflush(stdin);
	    printf("Codigo de libro: ");
	    gets(comp.cod);
	    printf("Cantidad: ");
	    fflush(stdin);
	    scanf("%d",comp.cant);
	    fwrite(&comp,sizeof(struct c),1,compras);
	    printf("\n-----------------\n\n");
	    printf("Para ingresar los datos, ingrese un numero: ");
	    }


EDIT: I got it. I forgot the "&". Damn me.
||||||||||||||||||||
||||||||||||||||||||
||||||||||||||||||||

Last edited by urik at Dec 2, 2008,