I used below codes to pass a value from vector to my cpp file. While i'm doing that, i got segmentation error in my main cpp? Is there anyway to pass the vector value to my main cpp? thx for the help
void Loadfile()
{
//cout<<"this is used for loading file"<<endl;//check if the codes passing here
string line;
ifstream myfile;
vector <string> myvector;
myfile.open(DATAFILE); // Open the datafile
if (myfile.is_open()) //check If it worked
{
while (getline(myfile,line,'\n'))//get whole line from DATAFILE
{
//cout<<i++<<endl;//to test if the codes work correctly
myvector.push_back(line); //store them in vector
}