Ver Mensaje Individual
  #13 (permalink)  
Antiguo 16/12/2010, 11:14
nitsuga1986
 
Fecha de Ingreso: octubre-2008
Mensajes: 91
Antigüedad: 15 años, 6 meses
Puntos: 0
Respuesta: leer una matriz desde fichero en C

Este es mi codigo:
fp = fopen("ejemplo1.dat","r");
c = getc(fp) ;
for(i=0;i<17;i++){
for(j=0;j<19;j++){
while (c!= EOF)
{
fscanf(fp, "%d", escenario[i][j]);

}
}
}
fclose(fp);

el ejemplo1.dat contiene esto:
1111111111111111111
1000000001000000001
1011011101011101101
1000000000000000001
1011010111110101101
1000010001000100001
1111011101011101111
1111010000000101111
1111000111110001111
1111010000000101111
1111011101011101111
1000010001000100001
1011010111110101101
1000000000000000001
1011011101011101101
1000000001000000001
1111111111111111111

cuando lo compilo me da este fallo:

warning: format ‘%d’ expects type ‘int *’, but argument 3 has type ‘int’
es en la linea donde hago el fscanf
y luego al ejecutarlo me da un fallo de segmentacion :S