printing - Wrong Output C Terminal -


i trying use ubuntu terminal display users input. if user enters "exit" program should quit. if user enters other "/dev/pts/1" should display "unable open writing". program keeps printing else statement no matter type in. please.

#include <stdio.h>  main() { file *fpt;   char str[100]; char term[20]; fpt = fopen("/dev/pts/1", "w");  while(1) {     printf("enter terminal display in: ");     scanf("%s", term);     if(term != "exit");     {         if(term == "/dev/pts/1")         {                        printf("enter text display: ");             scanf("%s", str);             fprintf(fpt,"%s\n", str);                }         else         {             printf("unable open %s writing\n", term);         }     } }     fclose(fpt); } 

use strcmp() compare strings:

#include <string.h>  if (strcmp(term, "/dev/pts/1") == 0) {     // strings equal } else {     // strings different. }