segmentation error in vector?!

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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
            }
You'll need to post more code. I don't see any problem with the above.

Where exactly is the segfault occuring?
Topic archived. No new replies allowed.