1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include "cbf.h"
#include "cbf_simple.h"
#include <cstdio>
#include <string>
#include <exception>
#include <iostream>
struct Error : public std::exception {
std::string s;
Error(std::string s):s(s){}
virtual const char* what() const throw() {return s.c_str();}
virtual ~Error() throw() {}
};
int main() {
std::string file("adscconverted_flat.cbf");
for (int cc=0; cc<20000; ++cc) {
cbf_handle cbf_h;
FILE* private_file = std::fopen(file.c_str(),"rb");
if (!private_file) throw Error("cbf file BAD_OPEN");
cbf_failnez ( cbf_make_handle (&cbf_h) )
cbf_failnez ( cbf_read_file (cbf_h, private_file, MSG_DIGEST))
//file handle must be left open & is closed by the cbf library.
cbf_detector detector1;
cbf_failnez ( cbf_construct_detector(cbf_h,&detector1,0) )
cbf_failnez ( cbf_free_detector(detector1) )
cbf_failnez ( cbf_free_handle (cbf_h))
//fclose(private_file);
}
}
|