• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: decoding a struct
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: decoding a struct


  • Subject: Re: decoding a struct
  • From: Alexander von Below <email@hidden>
  • Date: Sun, 18 Dec 2005 12:38:30 +0100

structs are standard c constructs and thus (unless I am entirely mistaken), do not provide runtime introspection like Objective-C does. The compiler knows about the struct, that's it.

But the easiest way you can dump it to disk is:

pngGraph myGraph;

int size = sizeof (myGraph);

void * myData = &mGraph;

Now you have the location and size of the struct and you can dump it using various methods.

The only other thing you could do is put a marker into the struct, but you can not ask a struct like you can as an Objective-C class at runtime.

Alex

On 18.12.2005, at 09:51, D. Walsh wrote:

I'm having an issue where I need to determine the contents of a struct, how can I dump it do disk

It's a mixture of ints, chars in single and array form, I know what the last 18 bytes are so decoding it would be fairly easy if I could find a way to do it.

Here is the basic struct typedef.

  typedef struct pngGraphStruct
  {
    unsigned char **pixels;
    int sx;
    int sy;
    int colorsTotal;
    int red[gdMaxColors];
    int green[gdMaxColors];
    int blue[gdMaxColors];
    int open[gdMaxColors];
    int transparent;
    int *polyInts;
    int polyAllocated;
    struct pngGraphStruct *brush;
    struct pngGraphStruct *tile;
    int brushColorMap[gdMaxColors];
    int tileColorMap[gdMaxColors];
    int styleLength;
    int stylePos;
    int *style;
    int interlace;
    int thick;
    int alpha[gdMaxColors];
    int trueColor;
    int **tpixels;
    int alphaBlendingFlag;
    int saveAlphaFlag;
    int AA;
    int AA_color;
    int AA_dont_blend;
    int cx1;
    int cy1;
    int cx2;
    int cy2;
  }
  pngGraph;

  typedef pngGraph *pngGraphPtr;


-- Dale

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: decoding a struct
  • Next by Date: info.plist Dependency proplem
  • Previous by thread: Re: decoding a struct
  • Next by thread: info.plist Dependency proplem
  • Index(es):
    • Date
    • Thread