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.
val = malloc(2 * nz * sizeof(double));
v = val;
for (i = 0; i < nz; i++) {
- fscanf(f, "%d %d %lg %lg\n", &I[i], &J[i], &v[0], &v[1]);
+ int num = fscanf(f, "%d %d %lg %lg\n", &I[i], &J[i], &v[0], &v[1]);
+ (void)num;
+ assert(num == 4);
v += 2;
I[i]--; /* adjust from 1-based to 0-based */
J[i]--;