-1

I am getting the error "The expression must be of class type, but it has type unsigned char*" in the line "for (int i = 0; i < u.Values.size(); i++)".

What am I doing wrong, and how do I do it correctly?

struct udtBinaryFeatures
{
    unsigned char Values[51];
};


wstring bytefeaturestowstring(udtBinaryFeatures &u)
{
    wstring s = L"";

    for (int i = 0; i < u.Values.size(); i++) 
    {
        if (i > 0)
        {
            s += L"-";
        }
        s += unsignedchartowstring(u[i]);
    }
    return s;
}
tmighty
  • 10,734
  • 21
  • 104
  • 218

1 Answers1

1

Your code doesn't work because c-style array don't have methods.

You can use instead: std::array<usigned char, 51> Values

Or add int Size = 51 to your struct and change i < u.Values.size(); to i < u.Size;

Darkolin
  • 71
  • 5