Slowly understanding.
As part of learning: I created a workspace. Then 2 projects. 1 project is a library archive, 2nd Project is a console executable.
I am running in on 64Bit, Win7 Professional , OS.
The library projects contains 1.h file and a .C file.
This creates a libswdlib.a file.
this is called/linked in 2nd project which creates the EXE file.
The snapshot shows the strange error.
Where am I doing the mistake ?
Here is the Code Snippets:
Code: Select all
#include <stdio.h>
#include <SwissDomain.h>
int main(int argc, char **argv)
{
SwissDomain xx("./Q8TCT8.txt");
cout<<xx.getDomainSequence()<<endl;
printf("hello world\n");
return 0;
}
Code: Select all
#include<iostream>
#include<string>
#include <fstream>
#include <sstream>
using namespace std;
class SwissDomain
{
int start_, end_;
string description_;
string sequence_;
public:
SwissDomain();
SwissDomain(string filename);
int getStartPosition();
int getEndPosition();
string getDomainSequence();
};
Code: Select all
#include<SwissDomain.h>
SwissDomain::SwissDomain(){ };
SwissDomain::SwissDomain(string filename)
{
ifstream fin(filename.c_str());
string oneline;
while ( getline(fin, oneline) )
{
if ( oneline.substr(0,2) == "FT" && oneline.substr(5,6) == "DOMAIN" )
{
string ig;
stringstream k2(oneline);
k2>>ig>>ig>>start_>>end_;
}
if ( oneline.substr(0,2) == "SQ" )
{
while ( getline(fin,oneline) && oneline.substr(0,2) != "//")
{
string kk;
stringstream k1(oneline);
while(k1>>kk)
sequence_ += kk;
}
}
}
}
int SwissDomain::getStartPosition(){ return start_;}
int SwissDomain::getEndPosition(){ return end_;}
string SwissDomain::getDomainSequence(){
return sequence_.substr(start_-1, end_-start_+1);
}