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. How i put a CArray as a parament in a function

How i put a CArray as a parament in a function

Scheduled Pinned Locked Moved C / C++ / MFC
16 Posts 4 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.
  • M Mark Salsbery

    I'm sorry...what? :confused: What do you mean you "press ok"? Runtime? Design time? I'm lost :) Mark

    "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

    I Offline
    I Offline
    Immunity18
    wrote on last edited by
    #7

    hehehe sorry i let you alone inside forest:D Ok here i am to rescue u ! i use Microsoft Visual studio C++ 6.0 enviroment i press right click on the Class and press Add member function on the window it pop up i time Type: double Function declaration : Find(CString file , ....) and i have to press OK or cancel :D

    M 1 Reply Last reply
    0
    • I Immunity18

      hehehe sorry i let you alone inside forest:D Ok here i am to rescue u ! i use Microsoft Visual studio C++ 6.0 enviroment i press right click on the Class and press Add member function on the window it pop up i time Type: double Function declaration : Find(CString file , ....) and i have to press OK or cancel :D

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #8

      Ohhh ok :) I've never used the add function wizard but I just tried it on VS 2003 .NET. I chose "Add/Add function.." for a class. Selected a return type typed a function name for the parameter type, I typed "CArray<int, int&> &" parameter name I typed MyIntArray clicked the Add button to add the parameter clicked Finish and the function was added to my class I'm not sure how different that is from VC 6 (I bet David Crow knows :)) Mark

      "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

      I 1 Reply Last reply
      0
      • M Mark Salsbery

        Ohhh ok :) I've never used the add function wizard but I just tried it on VS 2003 .NET. I chose "Add/Add function.." for a class. Selected a return type typed a function name for the parameter type, I typed "CArray<int, int&> &" parameter name I typed MyIntArray clicked the Add button to add the parameter clicked Finish and the function was added to my class I'm not sure how different that is from VC 6 (I bet David Crow knows :)) Mark

        "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

        I Offline
        I Offline
        Immunity18
        wrote on last edited by
        #9

        double CAnaktisiDlg::FindDF(CString file , CArray < CString, CString& > &FArray) is what i create (indetifier CArray error) double CAnaktisiDlg::FindDF(CString file , CArray < CString, CString& > FArray) same :/ according to you it had to be working fine :((

        M 1 Reply Last reply
        0
        • I Immunity18

          :( i put Find ( CString file , const CArray& FArray) c:\program files\microsoft visual studio\myprojects\anaktisi\anaktisidlg.h(18) : error C2143: syntax error : missing ',' before '&' c:\program files\microsoft visual studio\myprojects\anaktisi\anaktisidlg.h(18) : error C2059: syntax error : '&' C:\Program Files\Microsoft Visual Studio\MyProjects\Anaktisi\AnaktisiDlg.cpp(850) : error C2955: 'CArray' : use of class template requires template argument list c:\program files\microsoft visual studio\vc98\mfc\include\afxtempl.h(238) : see declaration of 'CArray' C:\Program Files\Microsoft Visual Studio\MyProjects\Anaktisi\AnaktisiDlg.cpp(851) : error C2511: 'Find' : overloaded member function 'double (class CString,const class CArray &)' not found in 'CAnaktisiDlg' c:\program files\microsoft visual studio\myprojects\anaktisi\anaktisidlg.h(14) : see declaration of 'CAnaktisiDlg'

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #10

          Immunity18 wrote:

          c:\program files\microsoft visual studio\myprojects\anaktisi\anaktisidlg.h(18) : error C2143: syntax error : missing ',' before '&'

          Did you forget #include <afxtempl.h> in your project's stdafx.h file?


          "A good athlete is the result of a good and worthy opponent." - David Crow

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          I 1 Reply Last reply
          0
          • I Immunity18

            :( i put Find ( CString file , const CArray& FArray) c:\program files\microsoft visual studio\myprojects\anaktisi\anaktisidlg.h(18) : error C2143: syntax error : missing ',' before '&' c:\program files\microsoft visual studio\myprojects\anaktisi\anaktisidlg.h(18) : error C2059: syntax error : '&' C:\Program Files\Microsoft Visual Studio\MyProjects\Anaktisi\AnaktisiDlg.cpp(850) : error C2955: 'CArray' : use of class template requires template argument list c:\program files\microsoft visual studio\vc98\mfc\include\afxtempl.h(238) : see declaration of 'CArray' C:\Program Files\Microsoft Visual Studio\MyProjects\Anaktisi\AnaktisiDlg.cpp(851) : error C2511: 'Find' : overloaded member function 'double (class CString,const class CArray &)' not found in 'CAnaktisiDlg' c:\program files\microsoft visual studio\myprojects\anaktisi\anaktisidlg.h(14) : see declaration of 'CAnaktisiDlg'

            K Offline
            K Offline
            Kevin McFarlane
            wrote on last edited by
            #11

            Here's an example of how to pass an array argument from the CArray implementation in afxtempl.h

            INT_PTR CArray::Append(const CArray& src)
            {
            ASSERT_VALID(this);
            ASSERT(this != &src); // cannot append to itself

            if(this == &src)
            	AfxThrowInvalidArgException();
            
            INT\_PTR nOldSize = m\_nSize;
            SetSize(m\_nSize + src.m\_nSize);
            CopyElements(m\_pData + nOldSize, src.m\_pData, src.m\_nSize);
            return nOldSize;
            

            }

            Kevin

            1 Reply Last reply
            0
            • D David Crow

              Immunity18 wrote:

              c:\program files\microsoft visual studio\myprojects\anaktisi\anaktisidlg.h(18) : error C2143: syntax error : missing ',' before '&'

              Did you forget #include <afxtempl.h> in your project's stdafx.h file?


              "A good athlete is the result of a good and worthy opponent." - David Crow

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              I Offline
              I Offline
              Immunity18
              wrote on last edited by
              #12

              #include "stdafx.h" its the first of my include

              D 1 Reply Last reply
              0
              • I Immunity18

                #include "stdafx.h" its the first of my include

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #13

                Immunity18 wrote:

                #include "stdafx.h" its the first of my include

                :confused: Meaning what?


                "A good athlete is the result of a good and worthy opponent." - David Crow

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                I 2 Replies Last reply
                0
                • I Immunity18

                  double CAnaktisiDlg::FindDF(CString file , CArray < CString, CString& > &FArray) is what i create (indetifier CArray error) double CAnaktisiDlg::FindDF(CString file , CArray < CString, CString& > FArray) same :/ according to you it had to be working fine :((

                  M Offline
                  M Offline
                  Mark Salsbery
                  wrote on last edited by
                  #14

                  Works for me but I'm on a different VS version. I also have included afxtempl.h in my projects, although I'm not sure if the wizard uses that... You can always add the function by hand :) Mark

                  "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

                  1 Reply Last reply
                  0
                  • D David Crow

                    Immunity18 wrote:

                    #include "stdafx.h" its the first of my include

                    :confused: Meaning what?


                    "A good athlete is the result of a good and worthy opponent." - David Crow

                    "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                    I Offline
                    I Offline
                    Immunity18
                    wrote on last edited by
                    #15

                    i because it was it wasn't visible and i thought u said did you forget to #include , in your project, the "stdafx.h" file ? And yes i didnt #include "afxtempl.h" but not that i forget ,because i didnt know i had :P

                    1 Reply Last reply
                    0
                    • D David Crow

                      Immunity18 wrote:

                      #include "stdafx.h" its the first of my include

                      :confused: Meaning what?


                      "A good athlete is the result of a good and worthy opponent." - David Crow

                      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                      I Offline
                      I Offline
                      Immunity18
                      wrote on last edited by
                      #16

                      Now i include it my double CAnaktisiDlg::FindDF(CString file , CArray < CString, CString > FArray) works fine thank you onces again David :D (both kevin and mark :D)

                      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