question

rqscaltt-4486 avatar image
0 Votes"
rqscaltt-4486 asked ·

'{': no matching toke found error visual studio

hey i'm new to coding i have a error that i can't fix. i don't know where to put the forgotten { can someone help me please. it says in line 50 that is at writeprocessmemory line


template<typename T> T RPM(SIZE_T adress) {
T buffer;
ReadProcessMemory(hProcess, (LPVOID)adress, &buffer, sizeof(T), NULL);
return buffer;
}
template<typename T> void WPM(SIZE_T address, T buffer) {
WriteProcessMemory(hProcess, (LPVOID)adress, &buffer, sizeof(buffer, NULL);
}

c++
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

IgorTandetnik-1300 avatar image
0 Votes"
IgorTandetnik-1300 answered ·

The error message is misleading - you have fewer closing parens ) than opening ones (. I imagine sizeof(buffer, NULL) was meant to be sizeof(buffer), NULL)

· 2 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

thank you! it helped but now i have this error at line 51 under writeProcessMemory it says syntax error: unexpected token '}', expected


template<typename T> T RPM(SIZE_T adress) {
T buffer;
ReadProcessMemory(hProcess, (LPVOID)adress, &buffer, sizeof(T), NULL);
return buffer;
}
template<typename T> void WPM(SIZE_T address, T buffer) {
WriteProcessMemory(hProcess, (LPVOID)adress, &buffer, sizeof(buffer), NULL)
}

0 Votes 0 ·

You are missing a semicolon at the end of the WriteProcessMemory line. Look at the ReadProcessMemory line for comparison.

By the way, if T is an array type then RPM will return the address of an array that no longer exists.

0 Votes 0 ·