Forum > Documentation (Maintaining -)
S variabile not a Null terminated string
(1/1)
funlw65:
Regarding the example from this wiki page, S variable is not a Null terminated string.
https://www.freepascal.org/docs-html/ref/refsu12.html#x35-460003.2.7
winni:
Hi!
The variable S would be a null-terminated string if the declaration was right.
'This is a null-terminated string.'#0
is longer than 30 chars. Change the declaration to
Var S : String[40];
Then everything is ok.
Original code:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Program three; Var S : String[30]; P : PChar; begin S := 'This is a null-terminated string.'#0; P := @S[1]; WriteLn (P); end.
Winni
PS.: The nonsense ' was done by the Forum software
funlw65:
Yes, that was the error - I wanted to see if someone counts the chars in the string :) .
af0815:
So it should be a Bug Report against the documentation .
( and against the forumsoftware with #39 too )
Navigation
[0] Message Index