locked
How to write a native byte array to a file.

Answers

  • Just found this earlier question and it seems like there is a problem here between DataWriter.WriteBytes() documentation mentioning array<unsigned char> where it should say Platform::Array<unsigned char> as well as Intellisense complaining about the constructor for Platform::Array. I think this will work.

            auto platformBuffer = ref new Platform::Array<BYTE>(byteBuffer, (UINT)sizeof(byteBuffer));
            writer->WriteBytes(platformBuffer);



    Filip Skakun


    • Edited by Filip Skakun Monday, April 16, 2012 6:56 PM Added link
    • Marked as answer by Filip Skakun Wednesday, April 18, 2012 5:42 AM
    Monday, April 16, 2012 6:55 PM
  • Yes, that compiles cleanly. Use the compiler as your final arbiter. Intellisense and documentation are still a work in progress for C++/CX.

    -Steve

    Tuesday, April 17, 2012 1:06 AM
    Moderator

All replies

  • Just found this earlier question and it seems like there is a problem here between DataWriter.WriteBytes() documentation mentioning array<unsigned char> where it should say Platform::Array<unsigned char> as well as Intellisense complaining about the constructor for Platform::Array. I think this will work.

            auto platformBuffer = ref new Platform::Array<BYTE>(byteBuffer, (UINT)sizeof(byteBuffer));
            writer->WriteBytes(platformBuffer);



    Filip Skakun


    • Edited by Filip Skakun Monday, April 16, 2012 6:56 PM Added link
    • Marked as answer by Filip Skakun Wednesday, April 18, 2012 5:42 AM
    Monday, April 16, 2012 6:55 PM
  • Yes, that compiles cleanly. Use the compiler as your final arbiter. Intellisense and documentation are still a work in progress for C++/CX.

    -Steve

    Tuesday, April 17, 2012 1:06 AM
    Moderator