[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

vector<byte> to LPBYTE conversion

Posted on 2011-10-19
5
Medium Priority
?
1,239 Views
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 ?
0
Comment
Question by:Wuotan
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:Pramod Bugudai
ID: 36998602
Something like below.

vector<BYYE> inVec;

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

Author Comment

by:Wuotan
ID: 36998653
Sorry but that didn't helped me with my problem.
0
 
LVL 35

Expert Comment

by:sarabande
ID: 36998847
simply use  &v[0] if v is your vector.

Sara
0
 
LVL 35

Accepted Solution

by:
sarabande earned 2000 total points
ID: 36998863
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().

Sara
0
 

Author Closing Comment

by:Wuotan
ID: 36998907
thank you very much!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month18 days, 11 hours left to enroll

834 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