warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
On success, these functions return the number of input items
successfully matched and assigned; this can be fewer than
provided for, or even zero, in the event of an early
matching failure.
case MATRIX_TYPE_INTEGER:
vali = malloc(nz * sizeof(int));
for (i = 0; i < nz; i++) {
- fscanf(f, "%d %d %d\n", &I[i], &J[i], &vali[i]);
+ int num = fscanf(f, "%d %d %d\n", &I[i], &J[i], &vali[i]);
+ (void)num;
+ assert(num == 3);
I[i]--; /* adjust from 1-based to 0-based */
J[i]--;
}