i have a graduation project on opengl
the program must draw lines on the screen then get charterers from a file and display them on the screen with the lines
i have wrote every part of the code and test it separately it work!
when i gather them the program stopped running
how can i make glprint read from a character variable
example:it work when i wrote

     but if i wrote 
         char temp;

the screen is empty.
also i wrote glutdfunctiondiplay(display) in the end of the main to display the lines,but it haven’t been executed because of the display list to keep the char on the screen,i wrote it in the display list code i gave compilation error!

please help me !

when you write “a” in your code you create a ‘string literal’ and one of the features of those is that the compiler will add the trailing ‘\0’ character that terminates strings.

when you only have a char there is no terminating ‘\0’ and your program is actually likely to crash because nothing stops glPrint from reading characters until it hits a ‘\0’ somewhere in memory.

the reason the screen remains empty is probably because the variable temp in the above code is used uninitialized (you never assign a value) and it just happens to be set to 0 by chance.

to fix this you could use something like this:

char tmp[2];
tmp[1] = '\0'; // set string terminator

tmp[0] = // read character from your file

glPrint(tmp, ... );

for your other issue: i have no idea and unless you show (at least) the compiler error it may be hard to say what is wrong.