stdlib: fix memory leak on file errors

stdlib: throw runtime error when reading invalid real number

stdlib: bugfix val (real) for empty strings

tdrimg: add another demo image
This commit is contained in:
slederer 2025-08-22 02:20:21 +02:00
parent 0ea7dcef29
commit 95cc02ffcb
3 changed files with 40 additions and 11 deletions

View file

@ -153,10 +153,12 @@ var f:file;
### Error Handling
When an I/O error occurs, the _IOResult_ function can be called to get the error code. Unlike TP, the _IOResult_ function requires a
file variable as a parameter. When you call _IOResult_, an error that may have occurred is considered to be _acknowledged_. If an
error is not ackowledged and you do another I/O operation, a runtime error is thrown.
error is not ackowledged and you do another I/O operation on that file, a runtime error is thrown.
That means you can either write programs without checking for I/O errors, while resting assured that the program will exit if an I/O error occurs. You can also choose to check for errors with _IOResult_ if you want to avoid having runtime errors.
If an I/O error occurs on a file, it is then considered closed. Closing a file in this state, or a file that has been closed normally, will cause a runtime error.
The function _ErrorStr_ from the standard library takes an error code as an argument and returns the corresponding textual description as a string.
Example: