Re: puts() quirk

new topic     » goto parent     » topic index » view thread      » older message » newer message

Bruce M. Axtens wrote:
> I don't know if anyone's noticed this before ... maybe it's old news.
> 
>     sequence a
>     sequence b
> 
>     a = { 'c', 'a', 't', 0, 0, 0 }
>     b = "dog"
> 
>     puts( 1, a & "\n"  )
>     puts( 1, b )
> 
> This outputs
>     catdog
> Rather than
>     cat
>     dog
> As one might expect.

Yes, that's old news.
If you want to output 0's, you should open a file
in "wb" (binary mode) and write to it. File 1 (standard output)
is opened in "w" mode (text mode), and it doesn't
handle 0's as you'd like. Also \n is converted to \r\n
which you might not like either. Someone recently asked for a
routine to force standard output into binary mode,
and I'm looking into it.

Regards,
    Rob Craig
    Rapid Deployment Software
    http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu