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. ATL / WTL / STL
  4. How to CComBSTR convert to char *?

How to CComBSTR convert to char *?

Scheduled Pinned Locked Moved ATL / WTL / STL
tutorialquestion
6 Posts 5 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
    alan top
    wrote on last edited by
    #1

    How to CComBSTR convert to char *?

    alantop

    M M Z 3 Replies Last reply
    0
    • A alan top

      How to CComBSTR convert to char *?

      alantop

      M Offline
      M Offline
      Monty2
      wrote on last edited by
      #2

      USES_CONVERSION;
      CComBSTR *pBString;
      ...
      ...
      char *pString = OLE2T(pBString);

      This should work.:~


      The original point and click interface was a Smith & Wesson.

      J 1 Reply Last reply
      0
      • A alan top

        How to CComBSTR convert to char *?

        alantop

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        The Complete Guide to C++ Strings, Part II - String Wrapper Classes[^]

        --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

        1 Reply Last reply
        0
        • M Monty2

          USES_CONVERSION;
          CComBSTR *pBString;
          ...
          ...
          char *pString = OLE2T(pBString);

          This should work.:~


          The original point and click interface was a Smith & Wesson.

          J Offline
          J Offline
          Jorgen Sigvardsson
          wrote on last edited by
          #4

          You're far better off with CW2A() et al (ATL7 and later). USES_CONVERSION is a biiiiiiig cludge. (Take a peek under the hood, and you'll see...)

          -- Mr. Bender's Wardrobe by ROBOTANY 500

          1 Reply Last reply
          0
          • A alan top

            How to CComBSTR convert to char *?

            alantop

            Z Offline
            Z Offline
            Zac Howland
            wrote on last edited by
            #5

            Do you have to use CComBSTR? If not, why are you using it? _bstr_t is a much more complete wrapper for BSTRs.

            If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

            J 1 Reply Last reply
            0
            • Z Zac Howland

              Do you have to use CComBSTR? If not, why are you using it? _bstr_t is a much more complete wrapper for BSTRs.

              If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

              J Offline
              J Offline
              Jorgen Sigvardsson
              wrote on last edited by
              #6

              If you want to eliminate CRT dependencies, CComBSTR is the way to go.

              -- Broadcast simultaneously one year in the future

              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