After spending a long time to find why my program didn't work, I discovered
something which seems to be a bug.
It's about the "Copy" function.
Here is a test program :
Program TestCopy;
Var
Chaine : String(1296); {That's the value I need in my real program}
SousChaine : String(9);
LongueurChaine : MedWord;
IndexPosition : MedWord;
Begin
Chaine := '1000000000';
LongueurChaine := Length(Chaine);
SousChaine := Copy(Chaine,LongueurChaine - 8,9); {Here is the problem}
Writeln('SousChaine : ',SousChaine); {Writes nothing !}
Writeln('Length(SousChaine) : ',Length(SousChaine)); {Writes 0}
IndexPosition := LongueurChaine - 8;
SousChaine := Copy(Chaine,IndexPosition,9); {Now it works}
Writeln('SousChaine : ',SousChaine); {Writes 000000000}
Writeln('Length(SousChaine) : ',Length(SousChaine)); {Writes 9}
{There is no problem with the "Delete" procedure :}
Delete(Chaine,LongueurChaine - 8,9);
Writeln('Chaine : ',Chaine) {Writes 1}
End.
I can't understand why "Copy" works with "IndexPosition" as parameter, but not
with "LongueurChaine - 8".
Is there something wrong in : Copy(Chaine,LongueurChaine - 8,9) ? Or is this
really a bug ?
I must confess I use GPC 2.8.1 (I need GRX and BGI2GRX that I failed to install
with the newest version).
If it's a bug, maybe it's solved now. In this case, excuse me for this somewhat
useless message.
--
"Couperin"