I\'m very new to C, and I am having trouble with fwrite.
I\'m looking to use a struct that holds two values:
struct keyEncode{
unsigned short key[2];
You are using sizeof
on a pointer, this won't calculate the size of the effective struct but the one of the pointer (that could be 4 or 8 bytes). Try with sizeof(struct keyEncode)
(sizeof(keyEncode)
is enough if you are using C++).
Then I don't get why you have 0xFFFF
as count, shouldn't it be just 1
?