Var - Char array in Allegro ?

This is a discussion on Var - Char array in Allegro ? within the C++ Programming forums, part of the General Programming Boards category; Hmmmm...... How do you convert a string into a char array? I need to use a string in a function ...

  1. #1
    SublicK
    Guest

    Var - Char array in Allegro ?

    Hmmmm......

    How do you convert a string into a char array?

    I need to use a string in a function that only takes chars....

    eg:

    (Allegro Code)

    string VarString = "BlahBlah"
    textout(screen,font,VarString,X,Y,C);


    but the textout function only allows chars...... hmmm

    How do I change the VarString into a char?

  2. #2
    Former Member
    Join Date
    Oct 2001
    Posts
    955
    in my allegro docs, it says that the TextOut function is like this:

    void textout(BITMAP* bmp, FONT* f, unsigned char* s, int x, int y, int color);

    so it uses char's, why are you using strings anyway?

    Oskilian

  3. #3
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    void textout(BITMAP* bmp, FONT* f, unsigned char* s, int x, int y, int color);
    Are you sure that's not a const char* s. If it's const you can do
    VarString.c_str(). Another possibility would be to over ride it with an inline version, so you have

    void textout(BITMAP* bmp, FONT* f, string& s, int x, int y, int color)
    which then calls the real textout.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 11-17-2008, 11:36 AM
  2. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  3. newbie needs help with code
    By compudude86 in forum C Programming
    Replies: 6
    Last Post: 07-23-2006, 08:54 PM
  4. server question
    By xddxogm3 in forum Tech Board
    Replies: 24
    Last Post: 01-21-2004, 12:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21