Re: [fpc-pascal] Adding file to string to the RTL

2020-10-09 Thread Jean SUZINEAU via fpc-pascal
Le 09/10/2020 à 10:15, Santiago A. via fpc-pascal a écrit : Just nitpicking. Shouldn't "try" be after the "reset" and after the "rewrite"? Why don't you allow to write an empty string? Yes, you're right, the Reset/Rewrite should be after the try. I admit this code is not general, just

Re: [fpc-pascal] Adding file to string to the RTL

2020-10-09 Thread Ryan Joseph via fpc-pascal
> On Oct 9, 2020, at 7:02 AM, Benito van der Zander via fpc-pascal > wrote: > > Writing a file should write the data in a temporary file and then rename the > temporary file to replace the target file. Otherwise it might destroy the > target file, without writing the new content, when there

Re: [fpc-pascal] Are record fields zeroed on declaration of a record?

2020-10-09 Thread Ryan Joseph via fpc-pascal
> On Oct 8, 2020, at 4:58 AM, Bo Berglund via fpc-pascal > wrote: > > OK, > is it possible to define the TMyRecord with default values so that > when I do Default(TMyRecord) it will be non-zero defaults written > instead of zeros? You need to make a method for tha. You can't even use

Re: [fpc-pascal] Adding file to string to the RTL

2020-10-09 Thread Benito van der Zander via fpc-pascal
They cannot be used on handles that do not support FileSeek() (sockets, pipes, stdin/stdout etc.). Well, it would be better if it could You can just incrementally resize the return array, when reading succeeds after seeking fails. I have a string load function doing that:

Re: [fpc-pascal] Adding file to string to the RTL

2020-10-09 Thread Santiago A. via fpc-pascal
El 06/10/2020 a las 01:08, Jean SUZINEAU via fpc-pascal escribió: In my own code I use BlockRead/BlockWrite, but I'm wondering if I've not seen this somewhere in RTL. https://github.com/jsuzineau/pascal_o_r_mapping/blob/TjsDataContexte/pascal_o_r_mapping/02_Units/uuStrings.pas

Re: [fpc-pascal] Are record fields zeroed on declaration of a record?

2020-10-09 Thread Michael Van Canneyt via fpc-pascal
On Fri, 9 Oct 2020, Bo Berglund via fpc-pascal wrote: On Thu, 8 Oct 2020 23:00:32 +0200 (CEST), Michael Van Canneyt via fpc-pascal wrote: On Thu, 8 Oct 2020, Ryan Joseph via fpc-pascal wrote: On Oct 8, 2020, at 5:14 AM, gabor via fpc-pascal wrote: You can define typed constant