Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CArray in CMap

CArray in CMap

Scheduled Pinned Locked Moved C / C++ / MFC
c++data-structureshelptutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Trupti Mehta
    wrote on last edited by
    #1

    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

    stefanmihaimogaS 1 Reply Last reply
    0
    • T Trupti Mehta

      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

      stefanmihaimogaS Offline
      stefanmihaimogaS Offline
      stefanmihaimoga
      wrote on last edited by
      #2

      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

      T 1 Reply Last reply
      0
      • stefanmihaimogaS stefanmihaimoga

        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

        T Offline
        T Offline
        Trupti Mehta
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups