ok ok ok

Started by
2 comments, last by Drew_Benton 18 years, 1 month ago
i know i really shouldnt be dabbling in this till i have more experience in C++ but this task was asigned to me so please bare with my stupidity
		garble1 -> md5.Update(hash, sizeof(hash)); md5.Final(garble1);
		garble2 -> md5.Update(hash, sizeof(hash)); md5.Update((u8 *)szSeed, strlen(szSeed)); md5.Final(garble2);
		garble3 -> md5.Update(garble1, sizeof(garble1)); md5.Final(garble3);
that is the code thats giving me errors but it's only the "garble1-3 ->" pointers heres is the errors
.\main.cpp(54) : error C2227: left of '->md5' must point to class/struct/union/generic type
        type is 'byte *'
.\main.cpp(54) : error C2228: left of '.Update' must have class/struct/union
.\main.cpp(55) : error C2227: left of '->md5' must point to class/struct/union/generic type
        type is 'byte *'
.\main.cpp(55) : error C2228: left of '.Update' must have class/struct/union
.\main.cpp(56) : error C2227: left of '->md5' must point to class/struct/union/generic type
        type is 'byte *'
.\main.cpp(56) : error C2228: left of '.Update' must have class/struct/union
now can anyone be nice enough to try and help me figure out a solution or atleast give me a hint? thank you very much
Advertisement
The error messages say that garble1, garble2, and garble3 are bytes, not class/struct/union, and you can't use -> on bytes. Tell us how you declare the garbles.
Didn't you ask this in a previous post? You got an answer there, too.

-> is the "indirect access" operator. It is applied on the right of a POINTER to a struct or class in order to access a member of said struct or class. If the object that -> is applied to is not a pointer (and doesn't overload operator->, but you need not concern yourself with that case), then application of -> is invalid. Instead you should use the . operator. For example:

SomeStruct  foo;SomeStruct *bar = new SomeStruct; foo.baz  = 10;  // Direct access via . operator.bar->baz = 20;  // Indirect access via -> operator.


Also not that applying either . or -> on the right of an object without members (such as a regular int) isn't valid either.

Sounds to me like garble1 through garble3 are not pointers to objects.
Quote:Original post by alnite
The error messages say that garble1, garble2, and garble3 are bytes, not class/struct/union, and you can't use -> on bytes. Tell us how you declare the garbles.


He's declared them as 'int's, to which I've told him in his other post 3 times (here, here, and here) what the problem is. I don't know if he has my responses filtered out or what... Maybe someone else can explain it [wink]

This topic is closed to new replies.

Advertisement