Seek to EOF of file of byte

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Seek to EOF of file of byte

Mark Morgan Lloyd-5
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.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Seek to EOF of file of byte

Graeme Geldenhuys-6
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.


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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Seek to EOF of file of byte

Mark Morgan Lloyd-5
On 18/11/17 19:30, Graeme Geldenhuys wrote:

> 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]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Seek to EOF of file of byte

pascalX
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 .... 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.

;)

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Seek to EOF of file of byte

Mark Morgan Lloyd-5
On 18/11/17 21:15, [hidden email] wrote:
> 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]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal