Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C Format function VFP implementation
Message
De
12/06/2015 01:45:12
 
 
À
11/06/2015 14:30:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01620846
Message ID:
01620940
Vues:
50
>>(2) Use api
>>You will have to define sprintf for each combination of number and type of parameters
>
>I had first visualized a .fll, where the data type has to be put into the correct C variable type from the parameter structure.
>Your idea of reusing the C-dll is even easier, but I'd strive to use the function signature with flexible parameter types , unless called often in SQL selects,
>where performance really counts and a direkt C call will be eliminate overhead.
>>
>>
>>*_______________________________________________________________________________
>function C_printf( out, sformat, p1, p2)
>if vartype (m.p2)=="C"
>	declare integer sprintf in msvcrt.dll as sPrintf_str_str ;
>   		string@, string, string, string
>		
>	return sPrintf_str_str (@m.out, m.sformat, m.p1, m.p2)
>
>else
>	declare integer sprintf in msvcrt.dll as sPrintf_str_int ;
>		string@, string, string, integer
>		
>	return sPrintf_str_int(@m.out, m.sformat, m.p1, cast(m.p2 as I))
>
>endif
>*_______________________________________________________________________________
>
(1) You can, but redeclaring sprinf() is a big overhead imo

(2) I am only declaring it on its first use - you are redeclaring it always
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform