I'm really not at all experienced with C++, but I have some changes to make in code that used to be maintained by someone else. The code that exists may not be the best, but I'm not looking to totally re-write the widget because it works for us with no problems to date.
Anyway, here is the current code... I'll put the psuedo code or what I would like to do in << >>. or commented //..
DWORD NumOfBytes = 0;
<<DWORD NumOfBytes2 = 0; // Don't know if this second NumOfBytes is needed or if first can be used twice>>
char Buf[1024];
<<char Buf2[1024];>>
char *pNextSetting = NULL;
CString str;
CPlugIn *pPlugIn;
NumOfBytes = GetPrivateProfileSection("OurApp Update PlugIns", Buf, 1024, m_IniPath);
<<NumOfBytes2 = GetPrivateProfileSection("OurApp Update PlugIns", Buf2, 1024, m_OldIniPath);>>
// Below is the current line of code, but I would really like this to become something like...
// pNextSetting = Buf + Buf2
pNextSetting = Buf;
//So, how do I combine the two buffers?
str = pNextSetting;
if (NumOfBytes > 0) {
while (*pNextSetting != 0x00) {
pPlugIn = new CPlugIn;
pPlugIn->Id = str.Left(str.Find("="));
pPlugIn->Version = str.Right(str.GetLength() - str.Find("=") - 1);
m_LocalPlugIns.SetAt(pPlugIn->Id, pPlugIn);
pNextSetting = pNextSetting + strlen(pNextSetting) + 1;
str = pNextSetting;
}
}
Again, it may not be the best and its older code, but it works so I'm hoping there isn't much rework needed to combine what I'm pulling from .ini files.