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
|
void load_file_test(char *name_file, GtkWidget** pInput) {
void * tmp=mallocFor(9);
size_t t=minSizeOfFor(9);
FILE *fp = fopen (name_file,"r");
if (fp == NULL) {
perror(name_file);
exit(0);
}
else {
int i,j;
char val;
for(i=0;i<9;i++){
j=0;
while(j<9){
fscanf(fp,"%c",&val);
int nb_case = j+9*i;
if(val!='_' && val!=' ' && val!=0x0A && val!='+' && val!='-'&& val!='|' && val!='=') {
//printf("val=%x[%c][%i,%i] ",val,val,i,j);
// on cree la valeur a fixé : 0x01 decaler de val-0x30-1
tmp=setAllOn0(tmp,t);
tmp=bit_to_1(tmp,t,val-0x30-1);
//val_hexa=short_to_hexa(val);
//printf("val_hexa=%x",val_hexa);
//setValue(g,i,j,tmp);
PangoFontDescription *desc=pango_font_description_new();
pango_font_description_set_weight(desc,PANGO_WEIGHT_BOLD);
gtk_widget_modify_font(GTK_WIDGET(pInput[nb_case]),desc);
/* chiffre dans la case */
gtk_entry_set_text(GTK_WIDGET(pInput[nb_case]),&val);
j++;
}else if(val=='_'){
j++;
}
}
//puts("--");
}
fclose(fp);
} |
Partager