POV-Ray : Newsgroups : povray.general : Feature Request: Binary #write : Re: Feature Request: Binary #write Server Time
30 Jul 2024 16:21:23 EDT (-0400)
  Re: Feature Request: Binary #write  
From: Christian Froeschlin
Date: 25 Mar 2009 16:03:02
Message: <49ca8df6@news.povray.org>
clipka wrote:

> Anyone else who thinks this would be a neat idea?

It's a neat idea! ;)

I feel a bit queasy about the syntax though, it doesn't
look right for SDL (or most other languages I know). A few
alternative suggestions

#writeb(fOut, "int16be", someVal1, someVal2)

-> my favourite

#write(fOut, "int16be", someVal1, someVal2)

-> on the unfounded assumption noone has ever written
    a #write statement with multiple values where the first
    one ist the string literal "int16be". Behavior could
    also depend on #version directive, or, with Tim's
    suggestion regarding #fopen, whether fOut refers
    to a binary file.

#writeb(fOut, "%hu%hu", someVal1, someVal2) or

-> well ...

#write(fOut, (int16be) someVal1, (int16be) someVal2)

-> with active suspension of disbelief you can pretend
    it's a cast to select from overloaded #write's ;)

Also, maybe it should be uint instead of int in case
you wish to add signed integers later?


Post a reply to this message

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