CArray in CMap
-
Hello, I use EVC++4 for ARMV4I device. I have come across a situation where I find difficult to figure out few things. I store data in a file like: 1+Oper 1+1+Dept 1+12+2+1.0+2+2.0+3.5+1+3.5 -------- ----------- - --------- --------- Obj 1 Obj 2 S Obj 3 Obj 3 S-> # of objects stored of Obj 3 type Now I am reading the file & I want data in a form where value of 1 from Obj 2 is against all the values of Obj 3. So, 1 Obj 3 Obj 3 For this I believe I should have a CArray in a CMap. The CArray can contain all Obj3 & value remains as the key of the CMap. I am not able to make out how do I declare the CArray & the CMap. I am getting errors of CArray: no operator = .... Can anyone help me create CArray & CMap respectively & also show how to add contents in the array & map rexpectively. While reading file, I might need to access the saved CArray & add more if I come across the same number again. I am using EVC so please provide only MFC or general C/C++ solutions - No std, ATL, etc. Evc doesn't support CArrayEx & CMapEx. Help is highly appreciated.
Thanks Terry
-
Hello, I use EVC++4 for ARMV4I device. I have come across a situation where I find difficult to figure out few things. I store data in a file like: 1+Oper 1+1+Dept 1+12+2+1.0+2+2.0+3.5+1+3.5 -------- ----------- - --------- --------- Obj 1 Obj 2 S Obj 3 Obj 3 S-> # of objects stored of Obj 3 type Now I am reading the file & I want data in a form where value of 1 from Obj 2 is against all the values of Obj 3. So, 1 Obj 3 Obj 3 For this I believe I should have a CArray in a CMap. The CArray can contain all Obj3 & value remains as the key of the CMap. I am not able to make out how do I declare the CArray & the CMap. I am getting errors of CArray: no operator = .... Can anyone help me create CArray & CMap respectively & also show how to add contents in the array & map rexpectively. While reading file, I might need to access the saved CArray & add more if I come across the same number again. I am using EVC so please provide only MFC or general C/C++ solutions - No std, ATL, etc. Evc doesn't support CArrayEx & CMapEx. Help is highly appreciated.
Thanks Terry
Well, part of the solution to your problem would be to serialize your CArray. To understand how to do that please have a look into Xavier John's Address Book[^]. If that isn't help you a lot please to MSDN page: Serialization in MFC[^]. Best regards, Mihai Moga
-
Well, part of the solution to your problem would be to serialize your CArray. To understand how to do that please have a look into Xavier John's Address Book[^]. If that isn't help you a lot please to MSDN page: Serialization in MFC[^]. Best regards, Mihai Moga
Well Mihai, I also like Serilization, but EVC+ with +WinCE is giving a tough time with serialization. All proper code yet write & Read serialized objects is not supportive. So I have to take the long route. WinCE also doesn't support AfxAPI SerializeElements for CMap. If ypu can give other solution, world be really helpful.
Thanks Terry