salve... ho un problema....
ho scritto un programma che salva delle struct su un file
le strutture sono collegate tra loro in questo modo:

codice:
typedef struct ord {
	char cod [20];
	char descr [DATI];
	int quant;
	char cod_ord[20];
	int stato_ord;
} Ord ;
	
/*struttura della scheda*/	
struct sched {
	char campo1;
        char campo2;
	Ord ordin[NORD];
	int campo4;
} scheda;
il programma deve fare una gestione degli ordini che sono associati a ciascuna scheda....
per far svolgere questo compito ho scritto questa funzione:

codice:
void ricOrd (void){
	int n;
	int i = 0;
	char pausa;
	
	fp = fopen("lab.dat", "r+");
	
	for(;;) {
		n = fread( &scheda, sizeof (struct sched), 1, fp);
		if (n == 0) {
			printf("\n NON CI SONO ORDINI DA EVADERE");
			scanf("%c", &pausa);
			return;
			}
		

		else{
		printf("______________________________________________");
		i = 0;
		while(i <= NORD){
			if (scheda.ordin[i].stato_ord == 0 && scheda.ordin[i].quant != -1){
				printf("\n\n........");
				printf("\n\n Codice articolo: %s", scheda.ordin[i].cod_ric);
				printf("\n Descrizione: %s", scheda.ordin[i].descr_ric);
				printf("\n Quantità: %d", scheda.ordin[i].quant);
				printf("\n\n........");
				printf("\n\n Inserire codice ordine:  ");
				gets(scheda.ordin[i].cod_ord);
				printf("\n\n ordinato? 1 si, 0 no:  ");
				scanf("%d", &scheda.ordin[i].stato_ord);
				scanf("%c", &pausa);
				printf("\n\n-----------------------------");
				i++;
				
				}
				
			else
				i = NORD + 1;
		
		}
		printf("______________________________________________");	
		
		fwrite(&scheda, sizeof(struct sched),1 , fp);
		}	
		}
	
	scanf("%c", &pausa);
	

	fclose(fp);
	}
il problema è che lo scanf che dovrebbe settare lo stato dell'ordine non lo fa

non capisco come mai fa questo comportamento