Skip to content

Instantly share code, notes, and snippets.

@yxbh
Created May 10, 2015 05:47
Show Gist options
  • Save yxbh/70186a7e8297dab1dfc1 to your computer and use it in GitHub Desktop.
Save yxbh/70186a7e8297dab1dfc1 to your computer and use it in GitHub Desktop.
char buf[1000];
recev(buf, 1000); // buf is filled magically.
char * p = buf;
uint16_t ptype = *(uint16_t*)(p);
struct AResponse
{
uint16_t ptype;
bool is_successful;
// ... variables.
};
switch (ptype)
{
case 51:
AResponse * res;
res = *(AResponse*)(p);
if (res->is_successful)
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment