Mar 23, 2016 at 7:18pm UTC
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
Mar 23, 2016 at 9:15pm UTC
Thanks, I stared at this way too long and missed that.