Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-11

Seek to EOF of file of byte

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote
How should one do this? https://www.freepascal.org/docs-html/current/rtl/system/seekeof.html implies that it's only for text files, Seek(f, FileSize(f)) seems excessive.

Just curious, why would you consider the "old technology" instead of using TFileStream (or any of the other TStream descendants).

I'm actually busy converting some old apps that used "t: Text" style coding, and replacing it with more modern Stream-style code, and it works really well. Streams are so much more flexible.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Mark Morgan Lloyd
to Graeme Geldenhuys
Graeme Geldenhuys wrote 10 lines
On 2017-11-18 15:44, Mark Morgan Lloyd wrote:> How should one do this?> https://www.freepascal.org/docs-html/current/rtl/system/seekeof.html> implies that it's only for text files, Seek(f, FileSize(f)) seems excessive. Just curious, why would you consider the "old technology" instead of using TFileStream (or any of the other TStream descendants). I'm actually busy converting some old apps that used "t: Text" style coding, and replacing it with more modern Stream-style code, and it works really well. Streams are so much more flexible.

With your propensity for "I wouldn't start from here" answers I'm surprised you're not on CIX :-)

Basically, because the program is being viewed critically by the ALGOL programmer whose code I'm converting, and a number of other people of a comparable generation and background. So while I'm using OO fairly heavily and threads where the architecture makes them appropriate ** I'm trying not to change stuff gratuitously.

** The original code tried to simulate up to 2x CPUs and up to 4x IOPs using a single thread. I'm trying to do it properly.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Unknown author
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote
because the program is being viewed critically by the ALGOL programmer whose code

Algol, one my all time favourite languages.

while .... wend
if .... fi

why is this not universally adopted?

I still comment my C code with fi's and wend's to keep track of what a bunch of curly braces actually refer to.

C : a high level language with power of assembler and the readability of .... assembler.

Python : a high level language with the readability of assembler and performance of MSBASIC.

;)

Reply by email

Mark Morgan Lloyd
to Unknown author
Show quoted text 7 lines
On 18/11/17 20:27, Mark Morgan Lloyd wrote:> because the program is being viewed critically by the ALGOL programmer > whose code Algol, one my all time favourite languages. while .... wendif .... fi why is this not universally adopted? I still comment my C code with  fi's and wend's to keep track of what a bunch of curly braces actually refer to.

/Don't/ get me going, particularly here. Basically, because Wirth threw his toys out of the pram when ALGOL-W was rejected, and rushed out Pascal as an alternative without looking at the few bits of ALGOL-68 which were useful for something. He didn't come to his senses until Modula-2 or his involvement with Ada (I'm not sure which came first) but by then the damage was done.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email