Changeset 5968 for anuga_core/source/anuga/shallow_water/urs_ext.c
- Timestamp:
- Nov 18, 2008, 12:45:04 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/urs_ext.c
r5967 r5968 226 226 { 227 227 elements_read = fread(total_number_of_stations, sizeof(int), 1, fp); 228 if ((int) elements_read != 1){ 229 fprintf(stderr, "(1) Read %d number of elements, should have been 1\n", 230 elements_read); 228 if ((int) elements_read == 0 && ferror(fp)){ 229 fprintf(stderr, "Error reading total number of stations\n"); 231 230 return -2; 232 231 } … … 240 239 block_size = *total_number_of_stations*sizeof(struct tgsrwg); 241 240 elements_read = fread(mytgs0, block_size , 1, fp); 242 if ((int) elements_read != 1){ 243 fprintf(stderr, "(2) Read %d number of elements, should have been 1\n", 244 elements_read); 241 if ((int) elements_read == 0 && ferror(fp)){ 242 fprintf(stderr, "Error reading mytgs0\n"); 245 243 return -2; 246 244 } … … 250 248 // Check that the mux files are compatible 251 249 elements_read = fread(&numsta, sizeof(int), 1, fp); 252 if ((int) elements_read != 1){ 253 fprintf(stderr, "(3) Read %d number of elements, should have been 1\n", 254 elements_read); 250 if ((int) elements_read == 0 && ferror(fp)){ 251 fprintf(stderr, "Error reading numsta\n"); 255 252 return -2; 256 253 } … … 267 264 block_size = numsta*sizeof(struct tgsrwg); 268 265 elements_read = fread(mytgs, block_size, 1, fp); 269 if ((int) elements_read != 1){ 270 fprintf(stderr, "(4) Read %d number of elements, should have been 1\n", 271 elements_read); 266 if ((int) elements_read == 0 && ferror(fp)){ 267 fprintf(stderr, "Error reading mgtgs\n"); 272 268 return -2; 273 269 } … … 302 298 /* Read the start and stop times for this source */ 303 299 elements_read = fread(fros + i*(*total_number_of_stations), 304 *total_number_of_stations*sizeof(int), 1, fp); 305 if ((int) elements_read != 1){ 306 fprintf(stderr, "(4) Read %d number of elements, should have been 1\n", 307 elements_read); 300 *total_number_of_stations*sizeof(int), 1, fp); 301 if ((int) elements_read == 0 && ferror(fp)){ 302 fprintf(stderr, "Error reading start times\n"); 308 303 return -3; 309 304 } … … 311 306 312 307 elements_read = fread(lros + i*(*total_number_of_stations), 313 *total_number_of_stations*sizeof(int), 1, fp); 314 if ((int) elements_read != 1){ 315 fprintf(stderr, "(5) Read %d number of elements, should have been 1\n", 316 elements_read); 308 *total_number_of_stations*sizeof(int), 1, fp); 309 if ((int) elements_read == 0 && ferror(fp)){ 310 fprintf(stderr, "Error reading stop times\n"); 317 311 return -3; 318 312 } … … 480 474 481 475 elements_read = fread(muxData, ((int) numData)*sizeof(float), 1, fp); 482 483 476 if ((int) elements_read == 0 && ferror(fp)) { 484 //fprintf(stderr, "Numdata = %d\n", (int) numData); 485 fprintf(stderr, "(6) Read %d number of elements, should have been 1\n", 486 elements_read); 477 fprintf(stderr, "Error reading mux data\n"); 487 478 return NULL; 488 479 }
Note: See TracChangeset
for help on using the changeset viewer.