01: // scrittura formattata
02: #include<stdio.h>
03: #include<stdlib.h>
04:
05: int main(int argc, char **argv){
06:
07: //array of strings
08: char str[][100] = { "pippo", "paperino", "pluto", "gastone", "topolino" };
09:
10: int i;
11:
12: FILE *fp;
13:
14: fp=fopen("files/stringhe.txt", "w");
15: if(!fp)
16: {
17: printf("Errore non riesco ad aprire il file!\n");
18: exit(1);
19: }
20:
21: for(i=0; i < 5; ++i)
22: {
23: fprintf(fp, "#%d: %s\n", i, str[i]); // like printf(), instead of writing on ther console, we write to a file using the same layout
24: }
25:
26: fclose(fp);
27:
28: return 0;
29: }
30:
31:
Se avete commenti o osservaƶioni su questa pagina
mandate un messaggio di posta elettronica a bertoƶƶi@ce.unipr.it
mandate un messaggio di posta elettronica a bertoƶƶi@ce.unipr.it