C newbie here. I wrote:
typedef unsigned char HBLOCK[SHA512_DIGEST_LENGTH];
typedef unsigned char HPRINTABLE[sizeof(HBLOCK)*2];
typedef struct {
HBLOCK Primary;
HBLOCK *Part;
} FILE_HASH_MAP;
void blockhex(const HBLOCK *, HPRINTABLE *);
intending to write the function to convert HBLOCK to hex string. However when I tried to test if individual characters are assignable
void blockhex(const HBLOCK *block, HPRINTABLE *printable)
{
printable[0]="6";
};
The compiler said error: incompatible types when assigning to type ‘HPRINTABLE’ from type ‘char *’. This puzzles me as I hoped the HPRINTABLE typedef would clearly indicate it to be an array type. Moreover, when I call it like this
FILE_HASH_MAP fhm;
HPRINTABLE prt;
blockhex(fhm.Primary,&prt);
The compiler also says "warning: passing argument 1 of ‘blockhex’ from incompatible pointer type" and "note: expected ‘const unsigned char (*)[64]’ but argument is of type ‘unsigned char *’" those are not errors, of course, but I'd like to know what I did wrong anyway.
Aucun commentaire:
Enregistrer un commentaire