diff options
Diffstat (limited to 'src/misc/vec/vecWrd.h')
-rw-r--r-- | src/misc/vec/vecWrd.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/misc/vec/vecWrd.h b/src/misc/vec/vecWrd.h index 9fa82f2d..b0123453 100644 --- a/src/misc/vec/vecWrd.h +++ b/src/misc/vec/vecWrd.h @@ -1368,24 +1368,27 @@ static inline Vec_Wrd_t * Vec_WrdReadBin( char * pFileName, int fVerbose ) } fseek( pFile, 0, SEEK_END ); nSize = ftell( pFile ); - if ( nSize % 8 > 0 ) + if ( nSize == 0 ) { - printf( "Cannot read file with simulation data that is not aligned at 8 bytes (remainder = %d).\n", nSize % 8 ); + printf( "The input file is empty.\n" ); fclose( pFile ); return NULL; } - else + if ( nSize % 8 > 0 ) { - rewind( pFile ); - p = Vec_WrdStart( nSize/8 ); - RetValue = fread( Vec_WrdArray(p), 1, nSize, pFile ); + printf( "Cannot read file with simulation data that is not aligned at 8 bytes (remainder = %d).\n", nSize % 8 ); fclose( pFile ); - if ( RetValue != nSize ) - printf( "Error reading data from file.\n" ); - if ( fVerbose ) - printf( "Read %d words of simulation data from file \"%s\".\n", nSize/8, pFileName ); - return p; + return NULL; } + rewind( pFile ); + p = Vec_WrdStart( nSize/8 ); + RetValue = fread( Vec_WrdArray(p), 1, nSize, pFile ); + fclose( pFile ); + if ( RetValue != nSize ) + printf( "Error reading data from file.\n" ); + if ( fVerbose ) + printf( "Read %d words of simulation data from file \"%s\".\n", nSize/8, pFileName ); + return p; } ABC_NAMESPACE_HEADER_END |