Converting C structure to Pascal - SOLVED lazarus / 8-Other ---------------------------------------------------------------------- IndianaJones · 2009-04-26 19:10 Hi all, I have a  data like this, unsigned char data[2048] = {    124,130,186,162,186,130,124,0,126,129,165,129,165,153,129,126,    126,129,165,129,153,165,129,126,108,246,246,254,124,56,16,0 }; Any idea what is the equivalent of pascal? Thanks ---------------------------------------------------------------------- IndianaJones · 2009-04-26 22:04 something like this, hope this helps someone. data : array[1..number of the data] of byte =       ( 124,130,186,162,186,130,124,0,126,129,165,129,165,153,129,126,    126,129,165,129,153,165,129,126,108,246,246,254,124,56,16,0,    16,56,124,254,124,56,16,0,16,56,84,254,84,16,56,0 ); Thanks. ---------------------------------------------------------------------- skalogryz · 2009-04-27 05:31 um. be VERY careful! C arrays always starts with Zero. So it's better co convertm them as: data : array [0...number of data - 1] of ... ---------------------------------------------------------------------- Vincent Snijders · 2009-04-27 07:14 IndianaJones, I am a bit worried that if you pass that structure to a C library it might write things after at index 1000 for example (the C struct has a size of 2048 bytes), and the pascal equivalent has far less bytes. This could cause memory corruption or access violations. I would convert it to Code: [Select]data : array[0..2047] of byte =       ( 124,130,186,162,186,130,124,0,126,129,165,129,165,153,129,126,    126,129,165,129,153,165,129,126,108,246,246,254,124,56,16,0,    16,56,124,254,124,56,16,0,16,56,84,254,84,16,56,0,    0, 0, .... (type here zeros for all missing element), 0 ); Typing all those zeros could be a pain. Then you can declare the data as variable and initialize it from a second (smaller) constant byte array at run time. ---------------------------------------------------------------------- IndianaJones · 2009-04-27 08:17 Thanks for the replies, I use this structure in the svgalib outtextxy question at the form, and it works like a charm. Anyway C counting (I mean start at zero) and Pascal counting are different and I consider that.