Why doesn't this program work?? I used C/C++ var types for input instead of Api because I didn't feel like overloading the >> operator.
Code:
#include <windows.h>
#include <iostream.h>
int main()
{char csubkey[70],clpvaluename[70];
HKEY hkResult;
long gooddelete;
int loop;
cout<<"Do you want to delete a registry value?"<<endl
<<"1 to delete, 0 to quit"<<endl;
cin>>loop;
while(loop)
{
cout<<endl<<endl<<endl<<"Name of subkey to delete:"<<endl;
cin>>csubkey;
cin.clear();
cin.ignore(80,'\n');
cout<<endl<<"Name of value to delete:"<<endl;
cin>>clpvaluename;
cin.clear();
cin.ignore(80,'\n');
RegOpenKeyEx(HKEY_CURRENT_USER,
csubkey,
0,0,
&hkResult);
gooddelete=RegDeleteValue(hkResult,clpvaluename);
RegCloseKey(hkResult);
cout<<endl<<endl<<endl;
if (!gooddelete)
{cout<<"Delete successful";}
else
{cout<<"Delete unsuccessful"<<endl<<endl;}
cout<<"Do you want to continue?"<<endl<<"1 to continue, 0 to quit"<<endl;
cin>>loop;
cin.clear();
cin.ignore(80,'\n');
}
return 0;
}
P.S. If there are no problems, can you please help me with how the input should be formatted: i.e. begin with \\ or just \ or use \\ the entire time or just \