I fixed a last (?) error. This line was not properly translated:
sscanf(str
, "%15s", Kommando
);
My first translation was:
StrLCopy(Kommando, str_, SizeOf(Kommando) - 1);
Which is obviously wrong.
Now it is:
FillChar(Kommando, SizeOf(Kommando), #0);
i := 0;
while (i < len) and (i < SizeOf(Kommando)) and ((str_ + i)^ <> #32) do
begin
Kommando[i] := (str_ + i)^;
Inc(i);
end;
I know there is a Pascal
sscanf function, but I didn't find how to use it in that case.
@TRon
After reflection,
'\n' (please notice the single quotes) is the equivalent of
#10, not
#13#10. So, it would probably be better to use
#13#10 as you suggested, but as my first goal was to translate the C program as it is, I went back to my first translation.
Here is the final (?) state of the program, if ever someone is interested. Thank you all for your help!