invalid null pointer

Hi I am working on my assignment where I have to create a database(text file) depending on user entries. An option in the front menu of my program is to provide a "modify" option to the user.
My issue is when I open my text file to compare the user entry with my text file entry I get a invalid null point error.
Here is my code.
Any help would be appreciated.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Assuming I make the call to my function "newName" from a nested switch statement, switch case ...

void newName(string M, string O)   // M = account number, O = New Name
{
	
	string newname = O;
	cout << "new name is" << newname;

	
	ifstream in_file;
	in_file.open("Accounts.dat");    //open the file

	if (in_file.fail())
	{
		cerr << " Error Opening File" << endl;
		exit(1);
	}

	const char* const DELIMITER = ";";
	const char* const DELIMITER1 = "+";
	const int MAX_TOKENS_PER_LINE = 50;
	const int MAX_CHARS_PER_LINE = 512;
	const char* token[MAX_TOKENS_PER_LINE] = {};  //

	


	while (!in_file.eof())                      //read until we reached the end
	{

		char buf[MAX_CHARS_PER_LINE];
		in_file.getline(buf, MAX_CHARS_PER_LINE);
		string S1 = buf;

		token[0] = strtok(buf, DELIMITER);
	
	
		if (token[0] == M)
		{
			string Newname;		
			
			cout << "Account Match Found"<<endl;		
			
			break;
		}
		
		
	}
	in_file.close();
}  
Show me the error message. Where do you have a bad pointer?
Topic archived. No new replies allowed.