Archived

This topic is now archived and is closed to further replies.

drunkentiger007

Font Problem?!?

Recommended Posts

I know the answer is probably very simple and Im just a moron for not knowing it but... Why does the following:
  

void CDirectX::DrawFont()
{
	char text[6] = "Hello";
	LPCSTR *my_text;
	my_text = &text;

	D3DXCreateFont( g_pDevice, hFont, &ppFont );
	ppFont->DrawTextA( *my_text, -1, NULL, DT_CENTER, D3DCOLOR_XRGB(100, 100, 100) );
}
  
Give this error: error C2440: ''='' : cannot convert from ''char (*)[6]'' to ''const char ** '' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast This is the function which I created to test fonts. Thanks alot, Kevin

Share this post


Link to post
Share on other sites
the variable name for an array is a pointer to the start of the array. so change to the following line:

my_text = text;

ie without the &

Share this post


Link to post
Share on other sites