Implement your own version of the ReadString procedure using
Implement your own version of the ReadString procedure,
using stack parameters. Pass it a pointer to a string and an integer
indicating the maximum number of characters to be entered. Return a
count (in EAX) of the number of characters actually entered. The
procedure must input a string from the console and insert a null byte
at the end of the string (in the position occupied by 0Dh). Write a
short program that tests your procedure.
Solution
faced a problem while working with procedures and strings in Delphi. The fact is that I expected to see the output string \"1S2S3S4S5S6S\" but the actual output is \"1234S5S6\". During the debug process it says that S1, S2, S3 and S6 string variables are not initialized (S1, S2, S3, S6 are \'\' strings, S4 and S5 have value \'S\'). Can someone explain to me this? Here\'s the codeprogram StringTest; {$APPTYPE CONSOLE} procedure MyProcedure(S1: String; const S2: String; var S3: String; S4: String; const S5: String; var S6: String; out S7: String); begin S7 := \'1\' + S1 + \'2\' + S2 + \'3\' + S3 + \'4\' + S4 + \'5\' + S5 + \'6\' + S6; end; procedure Work; var S: String; begin S := \'S\'; MyProcedure(S, S, S, S, S, S, S); writeln(S); end; begin Work; readln; end.