[Ok]v1.40: problems with clearing strings in an array

Beta Testing discussion on mikroPascal PRO for PIC.
Post Reply
Author
Message
Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

[Ok]v1.40: problems with clearing strings in an array

#1 Post by Dany » 19 Apr 2009 12:24

Can not be reproduced any more with bèta v1.50 :D

Hi, normally one can clear a string with

Code: Select all

StringVar := '';
but this seems not to work when the string is in a string array:

Code: Select all

const NrPrevCommands = 3;
var   PrevCommands: array[NrPrevCommands] of string[10];
..
for I := 0 to (NrPrevCommands - 1) do
  begin
    PrevCommands[I] := '';                   // <---- does not work, string is not "emptied"
    Uart1_Write_Text(PrevCommands[I]);       // added for test purposes
    Uart1_Write_Text(CRLF);
  end;
, but this works:

Code: Select all

for I := 0 to (NrPrevCommands - 1) do
  begin
    PrevCommands[I][0] := 0;                 // <---- does work
    Uart1_Write_Text(PrevCommands[I]);       // added for test purposes
    Uart1_Write_Text(CRLF);
  end;
Thanks in advance!

p.s. code was compiled for P16F877A
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Post Reply

Return to “mikroPascal PRO for PIC Beta Testing”