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 Copy TCHAR* Buff into CString Variable

How Copy TCHAR* Buff into CString Variable

Scheduled Pinned Locked Moved C / C++ / MFC
7 Posts 3 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.
  • A Offline
    A Offline
    aaaan
    wrote on last edited by
    #1

    Hi! All I want to copy Some data which is stroed in TChar Buff in to a CString Variable. How i do this. The TChar Buff has Raw data in which there are number of zeros present between raw data Ansh

    P 1 Reply Last reply
    0
    • A aaaan

      Hi! All I want to copy Some data which is stroed in TChar Buff in to a CString Variable. How i do this. The TChar Buff has Raw data in which there are number of zeros present between raw data Ansh

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #2

      aaaan wrote:

      TChar Buff in to a CString Variable.

      C'tor of CString or assignement operator will take care of that.

      e.g
      CString csString(pCharArr);
      or
      Cstring csString = pCharArr;

      aaaan wrote:

      The TChar Buff has Raw data in which there are number of zeros present between raw data

      Can you explain this?

      Prasad Notifier using ATL | Operator new[],delete[][^]

      D 1 Reply Last reply
      0
      • P prasad_som

        aaaan wrote:

        TChar Buff in to a CString Variable.

        C'tor of CString or assignement operator will take care of that.

        e.g
        CString csString(pCharArr);
        or
        Cstring csString = pCharArr;

        aaaan wrote:

        The TChar Buff has Raw data in which there are number of zeros present between raw data

        Can you explain this?

        Prasad Notifier using ATL | Operator new[],delete[][^]

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

        prasad_som wrote:

        Can you explaing this?

        Meaning that you can't do something like:

        CString str = "Now\0is\0the\0time\0for\0all...";


        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

        "Judge not by the eye but by the heart." - Native American Proverb

        A 1 Reply Last reply
        0
        • D David Crow

          prasad_som wrote:

          Can you explaing this?

          Meaning that you can't do something like:

          CString str = "Now\0is\0the\0time\0for\0all...";


          "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

          "Judge not by the eye but by the heart." - Native American Proverb

          A Offline
          A Offline
          aaaan
          wrote on last edited by
          #4

          ya i m unable to store data like CString str = "Now\0\0\0\0\0is\0\0\0\0the\0time\0for\0all..."

          D 1 Reply Last reply
          0
          • A aaaan

            ya i m unable to store data like CString str = "Now\0\0\0\0\0is\0\0\0\0the\0time\0for\0all..."

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

            Of course. Why would you think it was even possible?


            "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

            A 1 Reply Last reply
            0
            • D David Crow

              Of course. Why would you think it was even possible?


              "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

              A Offline
              A Offline
              aaaan
              wrote on last edited by
              #6

              ya I know it is not possible directly to CString variable. Bt i able to forcefully insert the raw data in CString variable taking data in a loop up to its length but it creats problem wn the length of data is very large i.e. more tn 1000 because running loop up to this limit creats problem of hanging.I want to solve this problem. if any soln pls help me.

              D 1 Reply Last reply
              0
              • A aaaan

                ya I know it is not possible directly to CString variable. Bt i able to forcefully insert the raw data in CString variable taking data in a loop up to its length but it creats problem wn the length of data is very large i.e. more tn 1000 because running loop up to this limit creats problem of hanging.I want to solve this problem. if any soln pls help me.

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

                Have you tried using memcpy()?


                "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

                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