#include "header_cpp.h"
#include "myreadpdb.h"

int main(int argc, char *argv[]){

    char pdbfile[100];
    strcpy(pdbfile, argv[1]);


    DCLPDB *p = new DCLPDB(pdbfile);


    p->Read();

    p->GetSeq();


    int NN = p->N;
    char *seq = new char [NN+1];

    int i,j,k;
    for(i=0;i<NN;i++) seq[i] = p->Seq[i];
    seq[NN] = '\0';

    char pdbid[100];
    for(i=0;i<100;i++) {

       if( (pdbfile[i] == '.')||(pdbfile[i]=='\0') ) {
		pdbid[i] = '\0';
		break;
	}
	pdbid[i] = pdbfile[i];
    }

    char fastafile[100];
    strcpy(fastafile, pdbid);
    strcat(fastafile, ".fa");

    ofstream fasta(fastafile, ios::out);

    fasta << ">gi|" << pdbfile << endl;
    fasta << seq << endl;

    fasta.close();

}

    

    

    
