src/readFMR.cpp
//' Print fingerprint minutiae record
//'
//' Print fingerprint minutiae record as specified in ANSI/INCITS 378-2004 and
//' ISO/IEC 19794-2:2005. Note that ANSI/INCITS 378-2004 and ISO/IEC 19794-2:2005
//' are older standards which may not be compatible with recent corrections.
//'
//' @usage printFMR(filepath, type)
//'
//' @param filepath character path to file containing the fingerprint minutiae
//' record (e.g. a "*.ist" file).
//' @param type character description of the record standard; one of the following:
//' - "ANSI_2004": ANSI/INCITS 378-2004 format
//' - "ANSI_2007": ANSI/INCITS 378-2007 format
//' - "ISO_2005": ISO/IEC 19794-2:2005 format
//' - "ISONC_2005": ISO/IEC 19794-2:2005 normal card format
//' - "ISOCC_2005": ISO/IEC 19794-2:2005 compact card format
//'
//' @note This R package is based on [NIST's BiomDI software](https://www.nist.gov/services-resources/software/biomdi-software-tools-supporting-standard-biometric-data-interchange) and includes the
//' libfmr C library. This function is adapted from the prfmr program.
//'
//' @export
// [[Rcpp::export]]
' Print fingerprint minutiae record
'
' Print fingerprint minutiae record as specified in ANSI/INCITS 378-2004 and
' ISO/IEC 19794-2:2005. Note that ANSI/INCITS 378-2004 and ISO/IEC 19794-2:2005
' are older standards which may not be compatible with recent corrections.
' Print fingerprint minutiae record ' ' Print fingerprint minutiae record as specified in ANSI / INCITS 378 - 2004 and ' ISO / IEC 19794 - 2 : 2005 . Note that ANSI / INCITS 378 - 2004 and ISO / IEC 19794 - 2 : 2005 ' are older standards which may not be compatible with recent corrections .
void print_fmr(std::string filepath, std::string type) {
  int in_type = stdstr_to_type(type);
  FILE *fp;
  struct stat sb;
  struct finger_minutiae_record *fmr;
  int ret;
  fp = fopen(filepath.c_str(), "rb");
  if (fp == NULL) {
    stop("open of file failed.\n");
  }
  if (stat(filepath.c_str(), &sb) < 0) {
    stop("Could not get stats on input file.\n");
  }
  if (new_fmr(in_type, &fmr) < 0) {
    stop("could not allocate FMR\n");
  }
  ret = read_fmr(fp, fmr);
  if (ret != READ_OK) {
    stop("Could not read fingerprint minutiae record");
  }
  if (validate_fmr(fmr) != VALIDATE_OK) {
    stop("Finger Minutiae Record is invalid.");
  }
  print_fmr(stdout, fmr);
  fclose(fp);
}
void print_fmr ( std :: string filepath , std :: string type ) { int in_type = stdstr_to_type ( type ) ; FILE * fp ; struct stat sb ; struct finger_minutiae_record * fmr ; int ret ; fp = fopen ( filepath . c_str ( ) , " " ) ; if ( fp == NULL ) { stop ( " \n " ) ; } if ( stat ( filepath . c_str ( ) , & sb ) < 0 ) { stop ( " \n " ) ; } if ( new_fmr ( in_type , & fmr ) < 0 ) { stop ( " \n " ) ; } ret = read_fmr ( fp , fmr ) ; if ( ret != READ_OK ) { stop ( " " ) ; } if ( validate_fmr ( fmr ) != VALIDATE_OK ) { stop ( " " ) ; } print_fmr ( stdout , fmr ) ; fclose ( fp ) ; }
' Print fingerprint minutiae record
'
' Print fingerprint minutiae record as specified in ANSI/INCITS 378-2004 and
' ISO/IEC 19794-2:2005.
' Print fingerprint minutiae record ' ' Print fingerprint minutiae record as specified in ANSI / INCITS 378 - 2004 and ' ISO / IEC 19794 - 2 : 2005 .