convert_byte_vector_to_string_vector

 

Description

Convert byte vector to string vector

Syntax

int convert_byte_vector_to_string_vector( const vector<byte> & vn, vector<string> & vs )

Parameters

vn
[input] byte array to convert
vs
[output] the vector to return string array

Return

the number of converted items

Examples

EX1

void convert_byte_vector_to_string_vector_ex1()
{
        vector<string> strVec(10);
        vector<byte> byteVec = {11,12,13,14,15,16,17,18};
        int nRet = convert_byte_vector_to_string_vector(byteVec , strVec);
        if(nRet)
        {
                printf("%d items converted :\n" , nRet);//Output: 8 items converted : 11 12 13 14 15 16 17 18 
                for(int ii = 0; ii < strVec.GetSize() ; ii++)
                        printf("%s " , strVec[ii]);
                printf("\n");
        }
        
        else 
                printf("Convert failed");
}

Remark

See Also

convert_double_vector_to_string_vector, convert_int_vector_to_string_vector, convert_string_vector_to_byte_vector

header to Include

origin.h

Reference