• Welcome to Dark Bit Factory & Gravity.
 

[Solved][C++] convert CHAR to CONST CHAR*

Started by Blacksheep8Bit, March 15, 2012

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Blacksheep8Bit

So, i am trying to make a Sine scroller, and i am having problems with it.

char frase[] = "Sine Scroller";
float ls = 1.0f;
int len = strlen(frase);

for (int i=0;i < len;i++)
{
glPushMatrix();
glTranslatef(-len*ls/2.0f + ls*i,0.0f,5.0f + sin((i*10 + t*4)DEG));
glRotatef(90.0f,1.0f,0.0f,0.0f);
GLfloat scale = 2.0f;
glScalef(scale,scale,scale);

Font::print((const char*)frase[i]); // Receives a const char* value.  // Error goes here.
glPopMatrix();
}


As you can see i am trying to obtain each letter from a "char" array (frase[]) and convert each letter to a "const char*" value so i can use the "Font:print" function, but i am having problems in this conversion, how to?


Edit: Mods please remove this thread
Challenge Trophies Won:

Jim

I could remove it  but what would be cooler, if you have a few spare moments, is to post how you fixed it. :)
Cheers!  :cheers:

Jim
Challenge Trophies Won:

LittleWhite

Hello,

I agree with Jim :)

The solution was something like :
Font::print(frase);
Since the function is accepting the char* directly. (Previous code was giving just one char to the function).
The demoscene will never die, never!

Blacksheep8Bit

Quote from: LittleWhite on March 16, 2012
Hello,

I agree with Jim :)

The solution was something like :
Font::print(frase);
Since the function is accepting the char* directly. (Previous code was giving just one char to the function).
The function didn't accept the char* directly...
Challenge Trophies Won: