[petsc-users] Wrapping PetscFPrintf

Dominik Szczerba dominik at itis.ethz.ch
Sat Nov 10 15:38:55 CST 2012


I need to have a wrapper to PetscFPrintf and PetscSynchronizedFPrintf.
I am aware of the problems and tried following as described here:


So I have:

	virtual bool VPrint(const char* format, va_list argp) = 0;
	virtual bool Print(const char* format, ...) = 0;

implemented as:

	bool CXCoreReporting::VPrint(const char* format, va_list argp)
		vfprintf(stderr, format, argp);
		return true;

	bool CXCoreReporting::Print(const char* format, ...)
		va_list argp;
		va_start(argp, format);
		VPrint(format, argp);
		return true;

Now the problem is that it just does not work... I still get trash
when calling e.g. Print("%d", i).
Does anyone see a way out?

Many thanks

More information about the petsc-users mailing list