Link to home
Start Free TrialLog in
Avatar of theta
theta

asked on

Find unix TERM within C program.

I am writing a file viewer, which will be used on different terminals in Unix environment. How can I find the current terminal type from within my C program. I tried using the following code:

char *str1;

str1 = (char *)(system("echo $TERM"));
printf("Terminal Type is: %s\r\n", str1);

But, it only echos the term type on the screen, and does not send anything in the variable str1. Any suggestions??
ASKER CERTIFIED SOLUTION
Avatar of rbr
rbr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial