diff options
Diffstat (limited to 'libcrystfel/src/crystfel-mille.c')
-rw-r--r-- | libcrystfel/src/crystfel-mille.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/libcrystfel/src/crystfel-mille.c b/libcrystfel/src/crystfel-mille.c index c2fe2a57..a62bf7b2 100644 --- a/libcrystfel/src/crystfel-mille.c +++ b/libcrystfel/src/crystfel-mille.c @@ -297,7 +297,7 @@ void write_mille(Mille *mille, int n, UnitCell *cell, } -Mille *crystfel_mille_new(const char *outFileName) +static Mille *mille_new() { Mille *m; @@ -311,6 +311,15 @@ Mille *crystfel_mille_new(const char *outFileName) m->have_local = NULL; m->n_local = 0; + return m; +} + + +Mille *crystfel_mille_new(const char *outFileName) +{ + Mille *m = mille_new(); + if ( m == NULL ) return NULL; + m->fh = fopen(outFileName, "wb"); if ( m->fh == NULL ) { ERROR("Failed to open Mille file '%s'\n", outFileName); @@ -318,6 +327,21 @@ Mille *crystfel_mille_new(const char *outFileName) return NULL; } + return m; +} + + +Mille *crystfel_mille_new_fd(int fd) +{ + Mille *m = mille_new(); + if ( m == NULL ) return NULL; + + m->fh = fdopen(fd, "wb"); + if ( m->fh == NULL ) { + ERROR("Failed to open Mille FD %i\n", fd); + cffree(m); + return NULL; + } return m; } |