How can I fix this error?

When I try to run this, it says that there were build errors. I don't know how to fix them and I really need help, any suggestions on how to fix it?

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
 #include <iostream>
#include <string>
#include <windows.h>
#include <WinBase.h>
#include <stdio.h>
using namespace std;
int i = 0;
int size;
char ToKey[];
bool Spam = false;
string Chars;
int a;


void Sendkey(char Key1) {
	keybd_event(VkKeyScan(Key1),0x9d,0,0);
	keybd_event(VkKeyScan(Key1),0x9d,KEYEVENTF_KEYUP,0);

}
int main() {
	auto size = sizeof(*ToKey)/sizeof(ToKey[0]);
	cout << "Enter Text." <<endl;
	cin >> ToKey;
	cout << "Put in  the word 'start' to activate it!";
	cin >> Chars;
	while(true) {

		if (Chars=="start") {
			if (Spam == false) {
			Spam = true;
			}
			else{
			Spam = false;}}
		if (Spam) {Sendkey(ToKey[i]);}
		if (i==size) 
		{
			Sleep(10);}
	i++;}
	cin.get();
	return 0;
}
Count your braces.
I checked and I believe I fixed it.
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
#include <iostream>
#include <string>
#include <windows.h>
#include <WinBase.h>
#include <stdio.h>
using namespace std;
int i = 0;
int size;
char ToKey[];
bool Spam = false;
string Chars;
int a;
bool Start = true;


void Sendkey(char Key1) {
	keybd_event(VkKeyScan(Key1),0x9d,0,0);
	keybd_event(VkKeyScan(Key1),0x9d,KEYEVENTF_KEYUP,0);

}
int main() {
	auto size = sizeof(*ToKey)/sizeof(ToKey[0]);
	cout << "Enter Text." <<endl;
	cin >> ToKey;
	cout << "Put in  the word 'start' to activate it!";
	cin >> Chars;
	while(Start) {

		if (Chars=="start") {
			if (Spam == false) {
			Spam = true;
			}
			else{
				return 0;}}
		if (Spam) {Sendkey(ToKey[i]);}
		if (i==size) 
		{ i = 0;
			Sleep(10);}
		i++;}

}
It still shows the problem.
What does it show?
I managed to fix a part of it, the array was static, but now I get the message: Unhandled exception at 0x01031aba in SpamBot.exe: 0xC0000005: Access violation reading location 0x01046000 after I allocated 6K bytes to the char array.
Topic archived. No new replies allowed.