Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C Format function VFP implementation
Message
 
 
To
11/06/2015 14:30:06
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01620846
Message ID:
01620919
Views:
53
>>(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
>*_______________________________________________________________________________
>
Did you see my question about decimal parameter? I've tried using word decimal and word float, none worked.

The string I'd like to be able to translate is
%.2f will be loaded onto your account.
or
Your %s card will be charged %.2f for this transaction.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform