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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
// =============================================================== //
// //
// File : ps_my2ascii.cxx //
// Purpose : //
// //
// Coded by Wolfram Foerster in October 2002 //
// Institute of Microbiology (Technical University Munich) //
// http://www.arb-home.de/ //
// //
// =============================================================== //
#include "ps_node.hxx"
// ====================================================
// ====================================================
int main(int argc, char *argv[]) {
//
// check arguments
//
if (argc < 3) {
printf("Missing arguments\n Usage %s <input database name> <output database name>\n", argv[0]);
exit(1);
}
//
// open probe-set-database
//
PS_Node *root = new PS_Node(-1);
const char *input_DB_name = argv[1];
PS_FileBuffer *ps_db_fb = new PS_FileBuffer(input_DB_name, PS_FileBuffer::READONLY);
printf("Opening input-probe-set-database '%s'..\n", input_DB_name);
root->load(ps_db_fb);
printf("loaded database (enter to continue)\n");
//
// write as ASCII
//
const char *output_DB_name = argv[2];
printf("writing probe-data to %s\n", output_DB_name);
ps_db_fb->reinit(output_DB_name, PS_FileBuffer::WRITEONLY);
char *buffer = (char *)malloc(512);
root->saveASCII(ps_db_fb, buffer);
printf("(enter to continue)\n");
//
// clean up
//
free(buffer);
delete ps_db_fb;
printf("(enter to continue)\n");
return 0;
}
|