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. error C2664 in MFC..?

error C2664 in MFC..?

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++question
25 Posts 4 Posters 3 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.
  • D David Crow

    Software_Specialist wrote:

    No it was working ...So i guess its right

    So what of your "And error i got is none of the 2 overloads could convert all the arguments type." comment? That does not sound like it is working, or right, to me.


    "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

    S Offline
    S Offline
    Software_Specialist
    wrote on last edited by
    #21

    oh by that i meant to say it was working like this... CString strFilter; const TCHAR *strSource= _T("All Files (*.*)|*.*||"); _tcscpy_s(strFilter, strSource); So Parameter isn't a problem in that...

    D 1 Reply Last reply
    0
    • S Software_Specialist

      oh by that i meant to say it was working like this... CString strFilter; const TCHAR *strSource= _T("All Files (*.*)|*.*||"); _tcscpy_s(strFilter, strSource); So Parameter isn't a problem in that...

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

      Software_Specialist wrote:

      CString strFilter; const TCHAR *strSource= _T("All Files (*.*)|*.*||"); _tcscpy_s(strFilter, strSource);

      :confused: How is this not generating a compiler error? I would have expected it to be:

      _tcscpy_s(strFilter.GetBuffer(128), strSource);

      In any case, why would you want to use _tcscpy_s() with a CString object? That makes no sense.


      "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

      S 1 Reply Last reply
      0
      • D David Crow

        Software_Specialist wrote:

        CString strFilter; const TCHAR *strSource= _T("All Files (*.*)|*.*||"); _tcscpy_s(strFilter, strSource);

        :confused: How is this not generating a compiler error? I would have expected it to be:

        _tcscpy_s(strFilter.GetBuffer(128), strSource);

        In any case, why would you want to use _tcscpy_s() with a CString object? That makes no sense.


        "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

        S Offline
        S Offline
        Software_Specialist
        wrote on last edited by
        #23

        Sorry... my brain is nt workin enough nw....need lil break.. actually it was TCHAR strFilter[1000]; const TCHAR *strSource=_T("All Files(*.*)|*.*||"); _tcscpy_s(strFilter, strSource); And this was definately working....i tested it aswell Rest ill find out after i finish writing these functions ....hoping for the best...:)

        D 1 Reply Last reply
        0
        • S Software_Specialist

          Sorry... my brain is nt workin enough nw....need lil break.. actually it was TCHAR strFilter[1000]; const TCHAR *strSource=_T("All Files(*.*)|*.*||"); _tcscpy_s(strFilter, strSource); And this was definately working....i tested it aswell Rest ill find out after i finish writing these functions ....hoping for the best...:)

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

          Software_Specialist wrote:

          TCHAR strFilter[1000]; const TCHAR *strSource=_T("All Files(*.*)|*.*||"); _tcscpy_s(strFilter, strSource);

          So why introduce an unnecessary variable (i.e., strSource) when

          TCHAR strFilter[1000];
          _tcscpy_s(strFilter, _T("All Files(*.*)|*.*||"));

          would have sufficed? Since you are using MFC, why bother with wchar_t variables at all?


          "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

          S 1 Reply Last reply
          0
          • D David Crow

            Software_Specialist wrote:

            TCHAR strFilter[1000]; const TCHAR *strSource=_T("All Files(*.*)|*.*||"); _tcscpy_s(strFilter, strSource);

            So why introduce an unnecessary variable (i.e., strSource) when

            TCHAR strFilter[1000];
            _tcscpy_s(strFilter, _T("All Files(*.*)|*.*||"));

            would have sufficed? Since you are using MFC, why bother with wchar_t variables at all?


            "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

            S Offline
            S Offline
            Software_Specialist
            wrote on last edited by
            #25

            may be u are right...But i tried that way but it was not working ..yeh i didnt included _T at that time...So ill check out if it works without const TCHAR variable... Thanks for pointing me out...

            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