# include "imregister.h"
# include "imreg.h"

/* scan from header into a string of fixed length */
int fits_scan_nchar (Header *header, int size, char *field, int N,...) {

  char *tmpstr, *outstr; 
  va_list argp;
  int status;
  
  va_start (argp, N);
  outstr = va_arg (argp, char *);
  va_end (argp);

  ALLOCATE (tmpstr, char, size); 
  status = fits_scan (header, field, "%s", N, tmpstr); 
  strncpy (outstr, tmpstr, size - 1);
  outstr[size-1] = 0; 

  free (tmpstr); 
  return (status);
} 
     
