Translating a variable from C to Delphi
Posted on 2002-03-12
I am currently, not very successfully, attempting to convert some C files I was given to use in a Delphi application I am writing. I have never used C before but have found it easy to read and translate.
One area I am finding difficult to get to grips with is being able to distinguish between a variable which looks like a PChar but sometimes behaves like a dynamic array.
For Example the variable B:
EXTERN unsigned char *A;
EXTERN unsigned char *B;
EXTERN unsigned smallint i,j;
A := B
B[i + j] := 128
If A and B was a PChars in Delphi then A := B would be acceptable but the following line would require an array type which B is not.
If A was a PChar but B was an Array of Char then the first line would generate an error whereas the second line would not.
Could someone please tell me how this variable, B, should be defined in Delphi.