Dark Bit Factory & Gravity

PROGRAMMING => C / C++ /C# => Topic started by: Blacksheep8Bit on March 15, 2012

Title: [Solved][C++] convert CHAR to CONST CHAR*
Post by: Blacksheep8Bit on March 15, 2012
So, i am trying to make a Sine scroller, and i am having problems with it.

Code: [Select]
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
Title: Re: [Solved][C++] convert CHAR to CONST CHAR*
Post by: Jim on March 16, 2012
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
Title: Re: [Solved][C++] convert CHAR to CONST CHAR*
Post by: LittleWhite on March 16, 2012
Hello,

I agree with Jim :)

The solution was something like :
Code: [Select]
Font::print(frase);Since the function is accepting the char* directly. (Previous code was giving just one char to the function).
Title: Re: [Solved][C++] convert CHAR to CONST CHAR*
Post by: Blacksheep8Bit on March 18, 2012
Hello,

I agree with Jim :)

The solution was something like :
Code: [Select]
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...