Posts by Gabriel Souto • 26 points
3 posts
-
1
votes1
answer128
viewsA: Save values from a text file to an array
#include <stdio.h> int main() { FILE *f; int v[10]; int N=0; f=fopen("numeros.txt", "r"); if(f==NULL) { printf("Não foi possivel abrir o ficheiro.\n"); return 0; } while(fscanf(f, "%d",…
-
0
votes1
answer2030
viewsA: Read only specific lines of . txt files in C
You must use binary mode files, they have similar functioning, to create/read/write binary files you must change the opening parameters of the fopen(), as an example fopen("arquivo.txt", "rb");.…
-
0
votes1
answer1110
viewsA: Problems with CRUD in C language
You can use the command setbuf(stdin, NULL); to clean the buffs between scans, because I’ve seen a lot of people complaining about fflush() by not working properly, in my projects I always use the…