[HELP!] Unhandled exception

Hi guys!
I made this topic becouse I have a problem and I think you guys can help me solving this.

I've got a config file for my program where I set variables, from the program I can change the first line of the config. I get the variables, edit the first variable, delete the config file and rewrite the config file. The first time I do this it works but the second time it crashes and I get this error:
Unhandled exception in 0x5F55E589 (msvcp120.dll) in ConsoleApplication1.exe: 0xC0000005: violation of access during the reading of the route: 0x0E64074A.
(I trasled the error in english so I don't know if it's correct)

The config file is like this:
1
2
3
4
Delay=200
LocalPlayer=A7AFBC
EntityList=4A1D354
GlowObjectBase=4B30324


And the important part of the code is:
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
if (GetAsyncKeyState(VK_F9))
		{
			system("cls");
			cout << "Edit Delay-mode activated!\n";
			cout << "Insert delay: ";
			cin >> delay;
			cout << "\nRe-writing config file....\n\n";
			string config1[5];
			ifstream configedit("config.txt");
			int i = 0;
			while (configedit)
			{
				getline(configedit, config1[i]);
				i++;
			}
			config1[0] = "Delay=" + to_string(delay);
			configedit.close();
			remove("config.txt");
			ofstream configedit2("config.txt");
			i = 0;
			while (i != 5)
			{
				cout << config1[i] << "\n";
				configedit2 << config1[i] << "\n";
				i++;
			}
			configedit2.close();
		}

Thanks for the help!
Last edited on
violation of access during the reading of the route
A tip: if you want to make the most out of programming resources and search engines, get used to configuring your systems and all your programs to use English.
The original version of this error message is "access violation reading location".

Lines 11-14: There's nothing here preventing i from being incremented well beyond the bounds of config1.

violation of access during the reading of the route
A tip: if you want to make the most out of programming resources and search engines, get used to configuring your systems and all your programs to use English.
The original version of this error message is "access violation reading location".

Lines 11-14: There's nothing here preventing i from being incremented well beyond the bounds of config1.


Thanks a LOT for your help. I was tired when I wrote this code so... Thanks! This did not solved my problem but it gived me an help. I declared the variable behind the #includes so I moved it in main. (I'm an idiot I know) :D
Topic archived. No new replies allowed.