Mail Archives: djgpp/1999/08/11/07:46:22
guthrie wrote:
>
> how can I , if even possible , print a string or char array out to the
> screen using the textout or textout_centre allegro functions?
>
> so far i have only used the functions as follows ::
>
> textout (screen, font , " Rotate Left " , 300 , 125, color1);
>
> using the string like that
>
> but what if i want to use a variable in place of the " Rotate Left " part
> ?
>
> do i have to use char[] or string ?.... i haven't been able to get string
> to work at all and haven't tried the char array yet.
>
> Is this possible or do i have to make a new toextout function?
>
use char[some_length] or char *.
Do not use any string classes.
Note that whenever you can implicitly use a string like "rotate left"
you can use a char * (char []). This is because "Rotate left" is
actually a constant pointer to the string "Rotate left" that's stuck
somewhere in your data segment. In other words, passing "Rotate left"
for a char * parameter is like passing 5 (or some constant) for an int
parameter.
Is that fairly clear?
moogla
- Raw text -