Code: Select all
#cmdline "-gen gcc -O 3"
#include "crt.bi"
var hCrt100 = DylibLoad("msvcr100.dll")
var hCrt = DylibLoad("msvcrt.dll")
dim as typeof(@sscanf) pfsscanf = DyLibSymbol(hCrt,"sscanf")
dim as typeof(@sscanf) pfsscanf100 = DyLibSymbol(hCrt100,"sscanf")
#if __Fb_Backend__ = "gcc"
declare function fnsscanf cdecl alias "__builtin_sscanf" (byval as zstring ptr, byval as zstring ptr, ...) as long
#endif
dim as zstring*64 pzChar = "7" !"\178" "2"
'178 and 127 = '2'
print pzChar
dim as single fResu
dim as long iLen
print "---------- sscanf ----------"
sscanf( pzChar , "%f%n" ,@fResu,@iLen )
printf(!"%g %i\n",fResu,iLen)
if hCrt then
print "---------- sscanf (dylib msvcrt.dll) ----------"
pfsscanf( pzChar , "%f%n" ,@fResu,@iLen )
printf(!"%g %i\n",fResu,iLen)
end if
if hCrt100 then
print "---------- sscanf (dylib msvcr100.dll) ----------"
pfsscanf100( pzChar , "%f%n" ,@fResu,@iLen )
printf(!"%g %i\n",fResu,iLen)
end if
#ifdef fnsscanf
print "---------- sscanf (built-in) ----------"
fnsscanf( pzChar , "%f%n" ,@fResu,@iLen )
printf(!"%g %i\n",fResu,iLen)
#endif
sleep
Code: Select all
7▓2
---------- sscanf ----------
7 3
---------- sscanf (dylib msvcrt.dll) ----------
7 3
---------- sscanf (dylib msvcr100.dll) ----------
7 1
---------- sscanf (built-in) ----------
7 3
it seems to only get triggered with \178 and \179 , and while it gets triggered with built-in and msvcrt one... it does not get triggered if i test this on C... which is VERY weird... (and at same time expected)
does everybody get the same behavior?