vector<byte> to LPBYTE conversion

Posted on 2011-10-19
Last Modified: 2013-12-14
I have a byte vector, but need to pass it to a function that only accepts LPBYTE.
How can I manage this conversion in VC++ no .net ?
Question by:Wuotan
    LVL 8

    Expert Comment

    by:Pramod Bugudai
    Something like below.

    vector<BYYE> inVec;

    void ProcessInput(const char *, vector<BYTE>*);

    Author Comment

    Sorry but that didn't helped me with my problem.
    LVL 32

    Expert Comment

    simply use  &v[0] if v is your vector.

    LVL 32

    Accepted Solution

    the std::vector holds an internal array of BYTE elements in your case. with v[0] you get a reference to first element of the internal array. with &v[0] you get a pointer to the internal byte array what is a LPBYTE in the MS terminology ("long" pointer to BYTE, the long comes from 16-bit windows).

    the size of the array is v.size().


    Author Closing Comment

    thank you very much!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
    Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now