Commit 806bee60 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

add reading gzipped dt-file.


Former-commit-id: d2bdb7236a297a4f0928dfaa73117c6eb6982b02
parent 393d4826
......@@ -371,6 +371,26 @@ void read_id ( char *fname , struct part *parts , int N ) {
void read_dt ( char *fname , struct part *parts , int N ) {
#ifdef HAVE_ZLIB
gzFile *fd;
char buff[1024];
int k;
/* Open the given file. */
if ( ( fd = gzopen( fname , "r" ) ) == NULL )
error( "Failed to open dt file" );
/* Read the coordinates into the part positions. */
for ( k = 0 ; k < N ; k++ ) {
if ( gzgets( fd , buff , 1024 ) == NULL )
error( "Error reading id file." );
if ( sscanf( buff , "%ef" , &parts[k].dt ) != 1 )
error( "Error parsing dt file." );
}
/* Wrap it up. */
gzclose( fd );
#else
FILE *fd;
int k;
......@@ -384,6 +404,10 @@ void read_dt ( char *fname , struct part *parts , int N ) {
error( "Error reading dt file." );
}
/* Wrap it up. */
fclose( fd );
#endif
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment