Hello again!
I have another question. I have a veriable type declared as a CString
passing into a pascal function with preceding it with VAR. I can modify the
variable in the called function correctly, but after the fuction is
complete, what should have been a modified CString is acutally not. I've
read some FAQs and apparently the only known problems are when passing a
CString in a special circumstance into a C Function.... here is some sample
code, the output is in the comments:
PROGRAM Main;
PROCEDURE MakeVolName ( VAR VolName : CString );
VAR
PasVolName : String[5];
BEGIN
PasVolName := '7.12';
write("PasVolName in MakeVoldName =");
writeln(Pasvolname);
{ Prints 7.12 -- correct }
Volname := String2CString(PasVolName);
write("VolName in MakeVolName = ");
{$x+}
writeln(VolName);
{ Prints 7.12 -- correct}
END;
VAR
VolName2 : CString;
BEGIN
VolName2 := 'test';
write("initially = ");
writeln(VolName2);
{ Prints test -- correct}
MakeVolID(VolName2);
write("ending = ");
{$x+}
writeln(VolName2);
{ Prints garbage -- not correct}
END.
OUTPUT:
initially = test
PasVolName in MakeVoldName =7.12
VolName in MakeVolName = 7.12
ending = `4øÿ¿ÿÿÿÿ
Any ideas? I am using gpc version 20010502, gcc 2.95.2 on Mandrake Linux
7.2 running kernel 2.2.17.
Thanks,
Adam Oldham
-----------------------------------------------------------------------
C. Adam Oldham Marconi Commerce Systems Inc.
Software Engineer 7300 West Friendly Ave.
adam.oldham(a)marconi.com Greensboro, NC 27420-2087
Phone : 336.547.5952 Fax : 336.547.5079
-----------------------------------------------------------------------
This document contains confidential information of Marconi Commerce
Systems Inc. In consideration of the receipt of this document, the
recipient agrees not to reproduce, copy, use or transmit this document
and/or the information contained herein, in whole or in part, or to
suffer such actions by others, for any purpose except with written
permission, first obtained, of Marconi Commerce Systems Inc., and
further agrees to surrender the same to Marconi Commerce Systems Inc.
upon demand.
-----------------------------------------------------------------------