replace space with a zero IP control

I have the following code which gives me an IP address in Hexadecimal to push
to a .ini file. The problem is where there should be Zeros. ie: 1 =01. it gives me a space.

DWORD dwIPAddress;
CString tempString;
m_strIP2.GetAddress(dwIPAddress);

m_strIP1.Format("%2x%2x%2x%2x",
HIBYTE(HIWORD(dwIPAddress)),
LOBYTE(HIWORD(dwIPAddress)),
HIBYTE(LOWORD(dwIPAddress)),
LOBYTE(LOWORD(dwIPAddress)),
HIBYTE(HIWORD(dwIPAddress)),
LOBYTE(HIWORD(dwIPAddress)),
HIBYTE(LOWORD(dwIPAddress)),
LOBYTE(LOWORD(dwIPAddress)));

UpdateData(FALSE);

I have tried
m_strIP1.Replace(" ",'0');
but the error I get is: no instance of overloaded function.

Any thoughts on how I can search for spaces and replace with Zero?

Thanks

Here, you are using different types of quotes, " and '

m_strIP1.Replace(" ",'0');

In the documentation, both parameters should be of the same type.
https://msdn.microsoft.com/en-us/library/aa300582%28v=vs.60%29.aspx
Thanks, I stared at this way too long and missed that.
Topic archived. No new replies allowed.