Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C Format function VFP implementation
Message
From
11/06/2015 14:30:06
 
 
To
11/06/2015 05:05:37
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:
01620916
Views:
71
This message has been marked as a message which has helped to the initial question of the thread.
>(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
*_______________________________________________________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform