Forum > Beginners
ReadFileToString 'raises an exception' - but it doesn't?
wp:
--- Quote from: dsiders on July 17, 2024, 08:06:17 pm ---
--- Code: Text [+][-]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";}};} ---... contains a n expanded value ...
--- End quote ---
Tiny typo: "a n" --> "an"
silvercoder70:
Quick random thoughts ...
Not sure of the exact use cases for this function design wise, but ...
if I were to use this function to read a config file, the currently implementation would be OK. If an empty string were returned if no file, then defaults could be easily applied.
if the file were needed, my preference is that a check is done before calling the function.
--- 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";}};} ---if not FileExists(...) then begin HandleError(...) Exit;end; contents := ReadFileToString(...);
Having to use/rely on exception handling makes things harder for the compiler (.exe) and when bad things happen, making a program inefficient.
dsiders:
--- Quote from: wp on July 17, 2024, 11:21:14 pm ---
--- Quote from: dsiders on July 17, 2024, 08:06:17 pm ---
--- Code: Text [+][-]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";}};} ---... contains a n expanded value ...
--- End quote ---
Tiny typo: "a n" --> "an"
--- End quote ---
I noticed that. Already fixed. Thanks.
Navigation
[0] Message Index
[*] Previous page