diff options
Diffstat (limited to 'libcrystfel/src/datatemplate.c')
-rw-r--r-- | libcrystfel/src/datatemplate.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c index e480779c..c11ec89d 100644 --- a/libcrystfel/src/datatemplate.c +++ b/libcrystfel/src/datatemplate.c @@ -2304,14 +2304,10 @@ static const char *str_dim(int dim) } -int data_template_write_to_file(const DataTemplate *dtempl, const char *filename) +int data_template_write_to_fh(const DataTemplate *dtempl, FILE *fh) { - FILE *fh; int i; - fh = fopen(filename, "w"); - if ( fh == NULL ) return 1; - /* Basic top-level parameters */ switch ( dtempl->wavelength_unit ) { @@ -2643,11 +2639,22 @@ int data_template_write_to_file(const DataTemplate *dtempl, const char *filename fprintf(fh, "\n"); } - fclose(fh); return 0; } +int data_template_write_to_file(const DataTemplate *dtempl, const char *filename) +{ + FILE *fh; + int r; + fh = fopen(filename, "w"); + if ( fh == NULL ) return 1; + r = data_template_write_to_fh(dtempl, fh); + fclose(fh); + return r; +} + + static void add_group_info(struct dg_group_info *ginfo, int *ppos, struct panel_group_template *group, int serial, int level, int c_mul) |