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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Passing byte array from C# to C++

Passing byte array from C# to C++

Scheduled Pinned Locked Moved C#
helpcsharpc++comsysadmin
1 Posts 1 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.
  • O Offline
    O Offline
    Ollie
    wrote on last edited by
    #1

    Hi, Have a little trouble passing a byte array in C# into a C++ implemented web service, the C# code is:- FileStream fs = new FileStream("c:\\work\\temp\\Waremouse.mp3", FileMode.Open); BinaryReader Reader = new BinaryReader(fs); Reader.BaseStream.Seek(0, SeekOrigin.Begin); long lLength = Reader.BaseStream.Length; Int32 nLength = System.Convert.ToInt32(lLength); byte[] bData = Reader.ReadBytes(nLength); fs.Close(); //********************************************** //C++ Web Service....... m_FileServer.UploadFile("Waremouse.mp3", bData); //********************************************** The C++ is implement as COM interface as shown below __interface IFBFileServerService { //Uploads a file onto the web server.... [id(1)] HRESULT UploadFile([in] BSTR bstrFileName, [in] byte* bData); //Downloads a file from the web server... [id(2)] HRESULT DownloadFile([in] BSTR bstrFileName, [out, retval] byte** bData); }; The problem is that an exception is thrown in the client application Cheers for any help :confused:

    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