1. Rob: What's up with this?
------=_NextPart_000_0005_01BFADC1.90E23360
charset="Windows-1252"
What's up with printf? Is printf just a wrapper of C's printf?
character #00 seems to just drop off into oblivion when using printf.
Hmm, I wonder, Does sprintf() have the same ill behavior?
The attached file creates a small file that will need to be viewed with
either a hex editor. It shows exactly what I am talking about.
sequence s
s = {'L', #00, 'L'}
puts(id, s)-- This works AND
for A = 1 to length(s) do
puts(id, s) --This works BUT
end for
printf(id, "%s%s%s", s) -- This fails AND
printf(id, "%s", {s}) -- This fails
Lucius L. Hilley III
lhilley at cdc.net
+----------+--------------+--------------+
| Hollow | ICQ: 9638898 | AIM: LLHIII |
| Horse +--------------+--------------+
| Software | http://www.cdc.net/~lhilley |
+----------+-----------------------------+
------=_NextPart_000_0005_01BFADC1.90E23360
name="whatsup.ex"
2. Re: Rob: What's up with this?
Lucius L. Hilley III writes:
> What's up with printf? Is printf just a wrapper of C's printf?
> character #00 seems to just drop off into oblivion when
> using printf. Hmm, I wonder, Does sprintf() have the same
> ill behavior?
Thanks. I'll fix this for the next release. It should be easy.
Currently, puts() will correctly send 0's to a file,
but printf() and sprintf() terminate the string at a 0 character.
Euphoria's printf() is more than just a wrapper for C's
printf(), in fact C's printf() is not even called to handle
Euphoria's %s format.
But, yes, at one point in the code, I slipped, and allowed
a 0 to terminate a string unexpectedly.
Regards,
Rob Craig
Rapid Deployment Software
http://www.RapidEuphoria.com