Date: Mon, 25 Oct 2004 20:43:31 +0200
To: [EMAIL PROTECTED]
From: Steven Van Ingelgem <[EMAIL PROTECTED]>
Subject: Formatting SQLite-query
Hi,
I wanted to create my own "Format"-thingie, based upon my own database:
-----------------------------------------------------
Source
-----------------------------------------------------
wxString SQLite3_Db::Format( const wxString& format, ... )
{
va_list marker;
va_start(marker, format);
char * t = sqlite3_vmprintf( format.mb_str(wxConvUTF8).data(), marker );
va_end(marker);
wxString retVal( t, wxConvUTF8 );
sqlite3_free( t );
return retVal;
}
-----------------------------------------------------
The problem here is that I get very weird results... Now tracing down, I found that in vxprintf (printf.c) "v = va_arg(ap,int);" is done (my first argument is %d).
Now what he gets there is the second parameter!
To be more clear:
SQLite3_Db::Format( "%d%s", 123, "Test" );
Then sqlite finds the first %d, tries to get the value of it, but finds the pointer pointing to 'Test'...
What did I do wrong?
Thx ;)
KaReL (aka Steven)
Main Webpage : http://www.karels0ft.be/
ICQ # : 35217584
KaReL (aka Steven)
Main Webpage : http://www.karels0ft.be/
ICQ # : 35217584
pgpWcJNF6rPt7.pgp
Description: PGP signature