From: daved170 on
Hi everybody,
I need to insert a DWORD value into the registry.
I exported a key to a file and tried to insert it back to the
registry.
My key was of type DWORD. for example: "ColorTable02"=dword:00008000

I've done that with the following code:

// string sKey = "ColorTable02"
// string sData = "00008000"

dwType = REG_DWORD;
dwSize = sizeof(DWORD);

int i = atoi(sData.c_str());

RegSetValueEx(hKey,sKey.c_str(),0,dwType,(PBYTE)&i,dwSize);

It work's fine BUT when sData contains letters such as "00f08a00". It
won't work.
offcourse it's because of the atoi function BUT I have no idea which
other function can do the work.

Thanks
Dave.
From: Vincent Fatica on
On Mon, 28 Dec 2009 11:30:28 -0800 (PST), daved170 <daved170(a)gmail.com> wrote:

|It work's fine BUT when sData contains letters such as "00f08a00". It
|won't work.
|offcourse it's because of the atoi function BUT I have no idea which
|other function can do the work.

strtoul()

You can specify hex (base = 16).
--
- Vince