By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,728 Members | 1,355 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,728 IT Pros & Developers. It's quick & easy.

reading a blob...

P: 2
Hi, i currently have a mysql database which stores a struct inside a blob
the structure is:
Expand|Select|Wrap|Line Numbers
  1. typedef struct NO_ALIGN st_minichar {
  2.     unsigned short packetSize; // 0x00 - 0x01
  3.     unsigned short command; // 0x02 - 0x03
  4.     unsigned char flags[4]; // 0x04 - 0x07
  5.     unsigned char unknown[8]; // 0x08 - 0x0F
  6.     unsigned short level; // 0x10 - 0x11
  7.     unsigned short reserved; // 0x12 - 0x13
  8.     char gcString[10]; // 0x14 - 0x1D
  9.     unsigned char unknown2[14]; // 0x1E - 0x2B
  10.     unsigned char nameColorBlue; // 0x2C
  11.     unsigned char nameColorGreen; // 0x2D
  12.     unsigned char nameColorRed; // 0x2E
  13.     unsigned char nameColorTransparency; // 0x2F
  14.     unsigned short skinID; // 0x30 - 0x31
  15.     unsigned char unknown3[18]; // 0x32 - 0x43
  16.     unsigned char sectionID; // 0x44
  17.     unsigned char _class; // 0x45
  18.     unsigned char skinFlag; // 0x46
  19.     unsigned char unknown4[5]; // 0x47 - 0x4B (same as unknown5 in E7)
  20.     unsigned short costume; // 0x4C - 0x4D
  21.     unsigned short skin; // 0x4E - 0x4F
  22.     unsigned short face; // 0x50 - 0x51
  23.     unsigned short head; // 0x52 - 0x53
  24.     unsigned short hair; // 0x54 - 0x55
  25.     unsigned short hairColorRed; // 0x56 - 0x57
  26.     unsigned short hairColorBlue; // 0x58 - 0x59
  27.     unsigned short hairColorGreen; // 0x5A - 0x5B
  28.     unsigned proportionX; // 0x5C - 0x5F
  29.     unsigned proportionY; // 0x60 - 0x63
  30.     unsigned char name[24]; // 0x64 - 0x7B
  31.     unsigned char unknown5[8] ; // 0x7C - 0x83
  32.     unsigned playTime;
  33. } MINICHAR;
  34.  
i want to be able to put it back into this format or at least read it so i can just get things out such as "name", "level", "_class" and "playTime"

Can anyone help?
May 12 '10 #1

✓ answered by Markus

How about fread()?

Share this Question
Share on Google+
2 Replies


Markus
Expert 5K+
P: 6,050
How about fread()?
May 12 '10 #2

P: 2
i should have mentioned im quite new to php...
how does fread work?
im sure i could work it out from there then =]
May 12 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.