Dear all
I am porting the code developed using sun cc and pc compilers to gpc and gcc
my pascal code looks like below ******************************************************* vstr_1024 = VARYING[1024] OF CHAR; (* while porting it to gpc converted above data type as "vstr_1024 = string[1024]"*)
FUNCTION sysget_symbol( VAR ENV : vstr_1024) : INTEGER; asmname 'sysget_symbol';
SysStatus:INTEGER; EnvString:vstr_1024;
SysStatus := sysget_symbol (EnvString); (*sysget_symbol is a C function*) *******************************************************
my C code looks like below ******************************************************* typedef struct { int length; char text[1024]; } NameString1024;
int sysget_symbol( NameString1024 *env) { (*code *) } *******************************************************
But the problem is after passing the vstr_1024 parameter to 'C' function,It is not reading properly.
My question is Do we have any data type equivalent to varying char array?
Please suggest me the alternative.
Regards Hari
__________________________________ Yahoo! FareChase: Search multiple travel sites in one click. http://farechase.yahoo.com
vanam srihari kumar a écrit:
Dear all
I am porting the code developed using sun cc and pc compilers to gpc and gcc
my pascal code looks like below
vstr_1024 = VARYING[1024] OF CHAR; (* while porting it to gpc converted above data type as "vstr_1024 = string[1024]"*)
FUNCTION sysget_symbol( VAR ENV : vstr_1024) : INTEGER; asmname 'sysget_symbol';
SysStatus:INTEGER; EnvString:vstr_1024;
SysStatus := sysget_symbol (EnvString); (*sysget_symbol is a C function*)
my C code looks like below
typedef struct { int length; char text[1024]; } NameString1024;
int sysget_symbol( NameString1024 *env) { (*code *) }
But the problem is after passing the vstr_1024 parameter to 'C' function,It is not reading properly.
My question is Do we have any data type equivalent to varying char array?
not predefined (string has in addition a capacity field), but you can define the pascal equivalent
type vstr_1024 = record length: Cinteger; text: array [0..1023] of char end;
you may have problems to manipulate afterwards in pascal. you will miss some predefined functions: then you may want either to affect to a regular string after reading (may be by rewriting a sysget_symbol function which reads in C and affects) or rewrite the string functions you need.