Re: Deleting a byte at the end of a file

In article <gh3qep$t0n$1@xxxxxxxxxxxxxxxxxxxxx>, Lorents <fdsa@xxxxx> wrote:
Gary Scott wrote:

This seems to work in CVF (note extensions)

program test

use dfwin

implicit none





Thank you Gary, I tried it with intel compiler 9.1 under linux and it
compiled and worked! Thanks!
In my case I used a single backspace instead of two; as it is your program
will delete 2 bytes at the end of the file (it works in your example
probably because your data.txt contained a trailing end-of-line invisible

Be warned - it is SERIOUSLY non-portable. That solution will not
work on any implementation that uses Unix append to implement that
positioning. However, no other solution will be much better, because
what you are trying to do makes no sense on many systems and is a
bit iffy even on many of those where it does make sense.

So always test such code every time you use it after a compiler
or system upgrade.

Nick Maclaren.

Relevant Pages

  • Re: CVF bug ?
    ... > | implicit none ... or I missed something) and it breaks compiler support for the ... stay at 6.6B and lost support for allocatable components, bug fixes ...
  • Xcode, Intel ifort and opening files
    ... I just started using the new Intel ifort compiler on Mac OS X 10.4.11. ... A simple test compiled and run from within XCode via the shiny 'Build and Go' button works fine in that it writes '201' to the output. ... END PROGRAM test ... Either this is a bug or most likely I am missing something important in how to set-up and use Xcode (I followed the instructions given by Intel on this, ...
  • Re: Fortran Newbie - Where to start?
    ... Does the new CVF-based Intel compiler ... for CVF here. ... garbage pointer, not a pointer to an intentionally read-only ... end program test ...
  • A floating point question, wierd problem
    ... implicit none ... When there is no "write" statment, the compiler does not force pi to be ... When I do the "writing", pi is now forced to be single precision, thus ...
  • Re: bug with Intel FORTRAN for Linux
    ... I have submited the case to the Intel support. ... If anybody have another compiler than the one cited, ... > Here is a program test: ... > Working with numbers close to computer precision is dangerous but I ...