Author Topic: [Solved][C++] convert CHAR to CONST CHAR*  (Read 4116 times)

0 Members and 1 Guest are viewing this topic.

Offline Blacksheep8Bit

  • *Custum Title goes here*
  • C= 64
  • **
  • Posts: 91
  • Karma: 36
  • *useless thing to write goes here*
    • View Profile
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
« Last Edit: March 15, 2012 by BlackSheep8Bit »
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [Solved][C++] convert CHAR to CONST CHAR*
« Reply #1 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
Challenge Trophies Won:

Offline LittleWhite

  • Senior Member
  • Amiga 1200
  • ********
  • Posts: 418
  • Karma: 31
  • It's me!
    • View Profile
Re: [Solved][C++] convert CHAR to CONST CHAR*
« Reply #2 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).
The demoscene will never die, never!

Offline Blacksheep8Bit

  • *Custum Title goes here*
  • C= 64
  • **
  • Posts: 91
  • Karma: 36
  • *useless thing to write goes here*
    • View Profile
Re: [Solved][C++] convert CHAR to CONST CHAR*
« Reply #3 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...
Challenge Trophies Won: