hi all
I searched google on how reading from registry and i have found this code

Code:
int main()
{
  char buffer[500];
  unsigned long size = sizeof(buffer);

  DWORD type;
  HKEY hKey;

  RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Visual Basic 5.0",&hKey);
  RegQueryValueEx(hKey,"Version",NULL,&type,(LPBYTE)buffer,&size);
  RegCloseKey(hKey);

  cout << buffer << endl;
  system("pause");
  return 0;
}
but i have a question, what if the size of the value in the registry key is bigger than 500 ?!!!
is there's a way to fix this problem without making the size of buffer 9999999999 lol