GetPrivateProfileInt counter

hi i have this and its giving me errors
'WritePrivateProfileStringA' : cannot convert parameter 3 from 'int' to 'LPCSTR'

int readCount = GetPrivateProfileInt("MyProgram","Count", 0, "C:/Counter.ini");
WritePrivateProfileString("MyProgram","Count",readCount + 1,"C:/Counter.ini");

what am i doing wrong? How can i add my count to the ini?
closed account (S6k9GNh0)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms725501%28v=vs.85%29.aspx

1. WritePrivateProfileString does not take an integer for it's 3rd parameter.
2. This really belongs in the "Windows Programming" section. Are you aware this function is deprecated?
3. Your topic is also misleading as that is not the problem.
Last edited on
Well i thought this was a help forum? is it not?
I have a problem that i dont know how to fix could give me some kinda help
closed account (S6k9GNh0)
I've given you the answer, documentation explaining my answer, and advice for next time you post.

(HINT: readCount + 1 returns an integer, you need a c string)

If you're using Windows, the solution is to either A) use the registry or B) use your own non-WinAPI solution. The function you're attempting to use is both inconvenient and deprecated.
Last edited on
Topic archived. No new replies allowed.