Browse Source

check for correct ammount of points in the file

pull/1/head
Chris Cromer 2 years ago
parent
commit
7b0092126d
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      src/read_file.c

+ 8
- 0
src/read_file.c View File

@ -239,6 +239,10 @@ int read_file(char *filename, point_t **points, unsigned int *n) {
break;
}
i++;
if (j > *n) {
fprintf(stderr, "Error: Hay demasiado puntos!\n");
return 8;
}
token = strtok(NULL, " ");
}
}
@ -246,6 +250,10 @@ int read_file(char *filename, point_t **points, unsigned int *n) {
buffer = NULL;
size = 0;
}
if (j < *n) {
fprintf(stderr, "Error: No hay suficiente puntos!\n");
return 9;
}
return 0;
}

Loading…
Cancel
Save