So in this conversion this is the only other VC++ 6==>VC++ 2005 issue i keep running into
Worked in VC++ 6
[source lang="cpp"]//////////////////////////////////////////////////////////////////////////////////////////void Packet::GetBuffer//////////////////////////////////////////////////////////////////////////////////////////// Returns the packet's buffer and its size.// ( LPBYTE &lpNewBuffer, // The buffer to put the value to. int &nBufferSize // The size of the buffer.)//////////////////////////////////////////////////////////////////////////////////////////{ lpNewBuffer = vBuffer.begin(); nBufferSize = vBuffer.size();}[/source]
Now it returns the error
error C2440: '=' : cannot convert from 'std::_Vector_iterator<_Ty,_Alloc>' to 'LPBYTE'
1> with
1> [
1> _Ty=BYTE,
1> _Alloc=std::allocator<BYTE>
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Definition of LPBYTE
typedef BYTE far *LPBYTE;
Using the standard Vector.h from the VC includes.
I tried a few things like copy and what not.
Change to Vector/Buffer Assignments?
Started by edb6377, Jul 21 2012 08:44 PM
5 replies to this topic
Sponsor:
#6 Members - Reputation: 629
Posted 22 July 2012 - 06:35 PM
The signature of your method and it's current implementation suggests that lpNewBuffer is not an allocated block of memory, and you want to extract a pointer to the buffer contained by vBuffer, along with the size. If that is the case, then std::copy will crash or corrupt memory unless you allocate new memory for lpNewBuffer within GetBuffer.






