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:
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??