POV-Ray : Newsgroups : povray.programming : file size with file_pov Server Time
23 Dec 2024 02:28:33 EST (-0500)
  file size with file_pov (Message 1 to 5 of 5)  
From: ABX
Subject: file size with file_pov
Date: 21 Jan 2003 02:40:52
Message: <iktp2vgbengh0evamff3k6fvugrbt3l3kr@4ax.com>
I noticed there is no method to get size of file using io classes from
file_pov.cpp. I wonder it is not implemented becouse there was no need for it
yet or becouse it can't work or becouse there are better ways to do it ?
Waiting for answer I have adjusted it for my purposes this way:

file_pov.h
  class pov_io_base
  {
    public:
      ......
      long fsize(void);
      ......
  }

file_pov.cpp
  ......
  #include <io.h>
  ......
  long pov_io_base::fsize (void)
  {
    return (filelength(fileno(f))) ;
  }


Is it a correct way according to intentions of io classes ?

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: file size with file_pov
Date: 21 Jan 2003 03:34:02
Message: <3e2d05fa$1@news.povray.org>
In article <iktp2vgbengh0evamff3k6fvugrbt3l3kr@4ax.com> , ABX 
<abx### [at] abxartpl>  wrote:

> Is it a correct way according to intentions of io classes ?

No, the code is not portable.

This has not been implemented because it was not needed.  The correct way to
implement it in a portable manner is to seek with zero bytes offset relative
to the end, then determine the file position and then to seek back to
wherever one ones before.

    Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Christoph Hormann
Subject: Re: file size with file_pov
Date: 21 Jan 2003 03:37:02
Message: <3E2D06AE.D7B6D67A@gmx.de>
ABX wrote:
> 
> I noticed there is no method to get size of file using io classes from
> file_pov.cpp. I wonder it is not implemented becouse there was no need for it
> yet or becouse it can't work or becouse there are better ways to do it ?
> Waiting for answer I have adjusted it for my purposes this way:
> 
> [...]

How about portability?

http://poli.cs.vsb.cz/c/help/io.htm#LBL42

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 31 Dec. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: ABX
Subject: Re: file size with file_pov
Date: 21 Jan 2003 03:50:49
Message: <bd2q2v49c9a6tps3o9hgqft71sk8naoa4i@4ax.com>
On Tue, 21 Jan 2003 09:34:00 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> This has not been implemented because it was not needed.  The correct way to
> implement it in a portable manner is to seek with zero bytes offset relative
> to the end, then determine the file position and then to seek back to
> wherever one ones before.

Thanks for hint.

ABX


Post a reply to this message

From: ABX
Subject: Re: file size with file_pov
Date: 21 Jan 2003 03:53:17
Message: <2e2q2vokm92fkb4jnv6nr2oe7ro5o0coh4@4ax.com>
On Tue, 21 Jan 2003 09:37:02 +0100, Christoph Hormann <chr### [at] gmxde>
wrote:
> How about portability?
>
> http://poli.cs.vsb.cz/c/help/io.htm#LBL42

Thanks, for unknown reasons I missed portability subsection in my own
resources.

ABX


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.