Untitled

mail@pastecode.io avatar
unknown
c_cpp
20 days ago
442 B
2
Indexable
Never

/*Esempio.txt

123 \n
456 \n
789 \n
101112 \n


*/
#include <stdio.h>

int main() {
    
    FILE * file = fopen("Esempio.txt", "r");
    if(file != NULL)
    {
        char s[200];
        int number;
        while(fgets(s, sizeof(s), file))
        {
            number = atoi(s);
            printf("%d", number);
        }
        
        fclose(file);
    }
    else
    {
        printf("Errore apertura file");
    }

    return 0;
}
Leave a Comment