Untitled

mail@pastecode.io avatar
unknown
c_cpp
5 months ago
545 B
2
Indexable

/*Esempio.txt

123
456
789
101112


*/
#include <stdio.h>

int main() {
    
    FILE * file = fopen("Esempio.txt", "r");
    if(file != NULL)
    {
        char s[200];
        fgets(s, sizeof(s), file);
        
        s=['3'][]['-4'][]['34'][]['6'][\0]
        int m = 6;
        
        char val = s[0];
        int res = val - '0';
        
        atoi()
        
        int somma = m + res;
        printf("%d", somma);
        
        fclose(file);
    }
    else
    {
        printf("Errore apertura file");
    }

    return 0;
}
Leave a Comment