Rik's Treehouse > Babbling in Binary > My Software > Orphanware > R2DToo > R2DToo Help > For the Programmer > dprintf

dprintf

Declaration
Parameters
Return Value
Remarks
Revisions
Example

Declaration

int __stdcall dprintf(
	const char *format,	// format specifier
	...	               	// argument
);
Top of page

Parameters

format
Format string like the standard C printf() function.
...
Arguments to the format string.
Top of page

Return Value

Returns the number of bytes written (neglecting the trailing newline character). Top of page

Remarks

This function is available through the API. It provides the model programmer with some primitive debugging functionality by displaying the argument of the function in a debug window and dumping the same to a debug file (always OutDbg1.txt in the current folder). The programmer can use this to display state variables and parameters as the simulation is being executed. The format of the parameters is identical to the standard C function printf(). See the documentation on printf() for more information. dprintf() differs in that it always appends a trailing newline character ( ) to every call to dprintf() to enhance readability of the debug window.
Top of page

Revisions

v1.2
  • new!
Top of page

Example

void __stdcall onTick(pParam param, double &time) { // print 10 parameters to debug window and OutDbg1.txt for (int i=0; i<10; i++) { dprintf("Parameter[%i] = %g",i,(float)param[i]); } }
Top of page
[Rik's Office Hours] [Contact Rik]
Last updated: Fri Apr 30 2004, 1:36pm