[fpc-pascal] Help converting C code

leledumbo leledumbo_cool at yahoo.co.id
Wed Feb 3 06:46:58 CET 2010


Does the BlockRead below:

type
  TRGBQuad = record
    rgbBlue: GLubyte;
    rgbGreen: GLubyte;
    rgbRed: GLubyte;
    rgbReserved: GLubyte;
  end;

...

var
  FileHandle: File;
  BytesRead: GLuint;
  FColorPalette: PRGBQuad;
  NumberOfColours: GLuint;

...

BlockRead(FileHandle,FColorPalette^,SizeOf(TRQBQuad)*NumberOfColours,BytesRead);

corresponds to this C code:

typedef struct tagRGBQuad {
  char rgbBlue;
  char rgbGreen;
  char rgbRed;
  char rgbReserved;
} RGBQuad;

...

RGBQuad *colours;
FILE *in;
int numColours;

...

fread(colours,sizeof(RGBQuad),numColours,in);

?
-- 
View this message in context: http://old.nabble.com/Help-converting-C-code-tp27431041p27431041.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.




More information about the fpc-pascal mailing list