On Fri, 4 Jul 2014, Sven Schreiber wrote:
Am 04.07.2014 00:37, schrieb Logan Kelly:
> Hello,
>
> I have found a possible issue with sprintf(). In the following script
> should not section 1 and 2 yield similar printed output? But note that
> bslash is empty after section 1 (output included). Is this the intended
> behavior? OS = Win 7 64bit and gretl = 1.9.91cvs
>
> #1
>
> sprintf bslash "\\"
>
> print bslash
>
> #2
>
> printf "\\"
>
Yes I can confirm this, which may not mean much because my OS parameters
here are identical. Also notice the following variation with four
backslashes:
<hansl>
#1
sprintf bslash "\\\\"
check = strlen(bslash)
print check
print bslash
#2
printf "\\"
</hansl>
which gives a string of length 1 and prints a single backslash here:
<output>
gretl-Version 1.9.91cvs
Aktuelle Sitzung: 2014-07-04 14:58
#1
? sprintf bslash "\\\\"
? check = strlen(bslash)
Ersetzte Skalar check = 1
? print check
check = 1.0000000
? print bslash
\
#2
? printf "\\"
\
</output>
This is now fixed in CVS. Updated snapshots will follow tomorrow or
on Monday.
Allin