GetBytes
Copy the elements of this vector into a byte type buffer.
int GetBytes( vector<byte> & vStream )
Returns 0 on success or a non-zero error code on failure.
EX1
void vectorbase_GetBytes_ex1() { // Decalare a vector of type int and fill with some data vector<int> vecData = {1,2,3,4,5}; // Declare a vector of type byte vector<byte> vecBytes; // Copy vecData into vecBytes vecData.GetBytes(vecBytes); // Check size of vecBytes - it should be "size of int" * "size of vecData" int iSize = vecBytes.GetSize(); if (iSize == sizeof(int) * vecData.GetSize()) printf("iSize is %d", iSize); else printf("Should NOT come here"); //Result: iSize is 20 }
Copy elements of the vector to an internal byte type buffer.
vectorbase::SetBytes
origin.h