28/02/12 14:50
Dante
Per cio che ho capito sscanf legge da una stringa"buffer" e memorizza negli argomenti "p.x" e "p.y", si può decidere la formattazione con il secondo parametro.
es:
tuttavia:
es:
char buffer[10]; pnt ps; /*il tipo punto, e definito in un altro file ha come membri 2 int*/ FILE *pfile = fopen(nomefile, "r"); fgets(buffer, 10, pfile); fclose(pfile); sscanf(buffer, "%i %i", ps.x, ps.y);
tuttavia:
cc sscanf.c -o sscanf
In file included from main.c:3:0:
sscanf.c: In function ‘cntrslz’:
sscanf.c:15:2: warning: format ‘%i’ expects argument of type ‘int *’, but argument 3 has type ‘int’ [-Wformat]
sscanf.c:15:2: warning: format ‘%i’ expects argument of type ‘int *’, but argument 4 has type ‘int’ [-Wformat]
In file included from main.c:3:0:
sscanf.c: In function ‘cntrslz’:
sscanf.c:15:2: warning: format ‘%i’ expects argument of type ‘int *’, but argument 3 has type ‘int’ [-Wformat]
sscanf.c:15:2: warning: format ‘%i’ expects argument of type ‘int *’, but argument 4 has type ‘int’ [-Wformat]
aaa