Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int ucitaj(struct Grad *gradovi, int n)
- {
- int br_gradova = 0, i = 0, j = 0;
- FILE *ulaz = fopen("gradovi.txt", "r");
- char c;
- while(!feof(ulaz)) {
- while(1) {
- c = fgetc(ulaz);
- gradovi[i].naziv[j] = c;
- j++;
- if((c >= '0' && c <= '9') || c == EOF || c == '\n') break;
- }
- gradovi[i].naziv[j - 2] = '\0';
- j = 0;
- fseek(ulaz, -1, SEEK_CUR);
- if(fscanf(ulaz, "%d\n", &gradovi[i].br_stanovnika) == 0) break;
- else i++;
- }
- if(i > n) br_gradova = n;
- else br_gradova = i;
- fclose(ulaz);
- return br_gradova;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement