From 7e4aab7d0a0901fb9b5b4f153722a9af15d9f1aa Mon Sep 17 00:00:00 2001 From: Kuoi Date: Fri, 3 Feb 2023 01:33:26 +0800 Subject: [PATCH] init --- main.cpp | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..71867fc --- /dev/null +++ b/main.cpp @@ -0,0 +1,87 @@ +#include +#include +#include +#include +#include +#include + +using namespace std; + +int datatype=0, ntax, nseq; +char * fn; + +void show_help(int help_num); +void read_input(void); + +int readPhy(){ + int num=0; + cout << "readphy is working, filename is " << fn << endl; + //read file + ifstream seqfile; + seqfile.open(fn); + //read number of taxa and charcter + string sntax, snseq, snall; + cout << "Reading from the file" << endl; + getline(seqfile,snall); + istringstream istr(snall); + istr >> sntax; istr >> snseq; + ntax = stoi (sntax); nseq = stoi (snseq); // string to int + cout << "ntax=" << ntax << " nseq=" << nseq << endl; + //read sequence + + seqfile.close(); + return num; +} + +void procargs (int nargs, char ** arg){ //*arg 视为整体,是字符串指针 + int i; + char * cp;//cp 字符指针 *p 第一个char + + //no arg, show help + if (nargs==1){ + show_help(0); + exit(0); + } + //recognize arg + for (i=1;i