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. stream object

stream object

Scheduled Pinned Locked Moved C / C++ / MFC
data-structures
7 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.
  • M Offline
    M Offline
    MKC002
    wrote on last edited by
    #1

    A function takes stream as input argument functionname(LPUNKNOWN pStream) I have character array and i need to use that function. How should i convert my array to LPUNKNOWN pStream

    M C L E 4 Replies Last reply
    0
    • M MKC002

      A function takes stream as input argument functionname(LPUNKNOWN pStream) I have character array and i need to use that function. How should i convert my array to LPUNKNOWN pStream

      M Offline
      M Offline
      Mohan Ramachandra
      wrote on last edited by
      #2

      Typecast..

      char arrc[10];
      functionName((LPUNKNOWN) arrc);

      M C 2 Replies Last reply
      0
      • M Mohan Ramachandra

        Typecast..

        char arrc[10];
        functionName((LPUNKNOWN) arrc);

        M Offline
        M Offline
        MKC002
        wrote on last edited by
        #3

        I TRIED THE SAME BUT WHEN I CALL FUNCTION IT GIVES EXCEPTION.

        1 Reply Last reply
        0
        • M Mohan Ramachandra

          Typecast..

          char arrc[10];
          functionName((LPUNKNOWN) arrc);

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          LPUNKNOWN is a pointer to a IUnknown interface (a COM object). You can't simply cast your string like that...

          Cédric Moonen Software developer
          Charting control [v3.0] OpenGL game tutorial in C++

          1 Reply Last reply
          0
          • M MKC002

            A function takes stream as input argument functionname(LPUNKNOWN pStream) I have character array and i need to use that function. How should i convert my array to LPUNKNOWN pStream

            C Offline
            C Offline
            Cedric Moonen
            wrote on last edited by
            #5

            LPUNKNOWN is a pointer to a IUnknown interface, which is a COM object. What are you trying to do exactly ? This is not the way you are supposed to work with the function. What is this function exactly ?

            Cédric Moonen Software developer
            Charting control [v3.0] OpenGL game tutorial in C++

            1 Reply Last reply
            0
            • M MKC002

              A function takes stream as input argument functionname(LPUNKNOWN pStream) I have character array and i need to use that function. How should i convert my array to LPUNKNOWN pStream

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              See here[^], I assume that the function requires a STD stream pointer.

              It's time for a new signature.

              1 Reply Last reply
              0
              • M MKC002

                A function takes stream as input argument functionname(LPUNKNOWN pStream) I have character array and i need to use that function. How should i convert my array to LPUNKNOWN pStream

                E Offline
                E Offline
                Eugen Podsypalnikov
                wrote on last edited by
                #7

                You could try the following :) :

                {
                char chBuffer[] = "1234567890";
                COleStreamFile cFile;
                if (cFile.CreateMemoryStream()) {
                cFile.Write(chBuffer, _countof(chFuffer));
                // Assumed the function "functionname" destroys the passed (IStream*)
                functionname(cFile.Detach());
                }
                } // Note: ~COleStreamFile() does not destroy the above detached stream

                virtual void BeHappy() = 0;

                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