Hello again everyone. I have come back to programming after a few weeks of not programming in fear that aliens have wiped only my knowledge of programming, or just brushing up on it (your choice).

So in brushing up I have came across a program that I have started to upgrade. The program searches a file specified in the program, but theres a glitch. When any of the words in the file are uppercased it will not recognize it as the lowercased word that the user types in so i have to make every letter lowercase. The way i have decided to do this is with tolower(). This isn't working for me so I so kindly ask you to please look at my code.

the tolower function is highlighted in blue. (I might have made a stupid mistake)

Code:
#include <stdio.h>
#include <string.h>
int searchnum = 0;
char getline[1000];

int lineh;
char lineap[20];
char fulllinechar[201];
int newline = 1;
FILE *fullline;
main()
{
      int linecheck;
      int printline = 0;
      FILE *pfile;
      FILE *file2;
      printf("made by Grant Oberhauser.");
      newline = 1;
      file2 = fopen("searchdata","w"); 
      fprintf(file2,"");
      
      fclose(file2);
      char search[20];
      printf("search params:");
      scanf("%s",&search);
      
    
      
      pfile = fopen("NEWS.txt","r");
      
      
      
      printf("searchtext:%s ",search);
      
      if (pfile == NULL)
      {
                printf("file does not exist, you fail");
                getch();
                return 0;
      }
      
  
  
      else
      {
             
           
           printf("\nreading:\n");
           
           while((lineh=fgetc(pfile)) != EOF)
           {
           
                                
                                      
                                      
           
                                      
                                      if(lineh == '\n')
                                      {
                                           newline++;
                                           
                                           if(printline == 1)
                                           {
                                                        
                                                               fullline = fopen("fullline","r");
                                                              while(fgets(fulllinechar,200,fullline) != NULL)
                                                              printf("%s\n",fulllinechar);
                                                              fclose(fullline);
                                                              
                                                              
                                           
                                                               
                                                              
                                           }
                                           
                                           
                                           fullline = fopen("fullline","w");
                                           fprintf(fullline,"");
                                           fclose(fullline);
                                           printline = 0;
                                           
                                           
                                      }
                                      
                                      if (isupper(lineh))
                                      {
                                                         file2 = fopen("searchdata","a");
                                                         
                                                         tolower(lineh);
                                                         
                                                         printf("to lower:%c ",lineh);                   
                                                         
                                                         fprintf(file2,"%c",lineh);
                                                         
                                                         fclose(file2);
                                                         
                                                         fullline = fopen("fullline","a");
                                                         
                                                         fprintf(fullline,"%c",lineh);
                                                         
                                                         fclose(fullline);
                                      
                                      }
                                      
                                      if (isspace(lineh) || ispunct(lineh))
                                      {
                                                              
                                                               
                                                               fullline = fopen("fullline","a");
                                                               fprintf(fullline,"%c",lineh);
                                                               fclose(fullline);
                                                               
                                                               
                                                               fullline = fopen("fullline","r");
                                                              while(fgets(fulllinechar,200,fullline) != NULL)
                                                              file2 = fopen("searchdata","r");
                                                              
                                                              
                                                              
                                                              
                                                              
                                                                                         
                                                              while(fgets(lineap,40,file2) != NULL)
                                                              
                                                              
                        
                                                              if (strcmp(lineap,search) == 0)
                                                              {
                                 
                                                                                      searchnum ++;
                                                                                      
                                                                                      
                                                                                      printf("(found #%d on line %d) full line:\n",searchnum,newline);
                                                                                      
                                                                                      printline = 1;
                                                                                      
                                                                                      beep(400,50);
                                 
                                 
                                 
                                                              } 
               
                                                              fclose(file2);
                                                              file2 = fopen("searchdata","w");
                                                              fprintf(file2,"");
                                                              
                                                              fclose(file2);
                                                              fclose(fullline);
                                        }
                                
                                        else if (linecheck != newline)
                                        {
                                             printf("line: %d\n",newline);
                                             
                                             linecheck = newline;
                                        }
                                         
                                        
                                        else
                                        {
                                                
                                                file2 = fopen("searchdata","a");
                                                if(isupper(lineh))
                                                {
                                                printf("to lower:%c ",lineh);
                                                 tolower(lineh);
                                                                  }
                                                
                                                fprintf(file2,"%c",lineh);
                                                fclose(file2);
                                                fullline = fopen("fullline","a");
                                                fprintf(fullline,"%c",lineh);
                                                fclose(fullline);
                                         }  
                                         
                                        
                                        
                                       
                }
                
                
               
               file2 = fopen("searchdata","r");
               while(fgets(lineap,40,file2) != NULL)
                                                              
                                                   
                        
                                                              if (strcmp(lineap,search) == 0)
                                                              {
                                 
                                                                                      searchnum ++;
                                                                                      
                                                                                      beep(400,50);
                                 
                                 
                                 
                                                              } 
               
                                                              fclose(file2);
                                                              file2 = fopen("searchdata","w");
                                                              fprintf(file2,"");
                                                         
                                                              fclose(file2);  
                                                              
                                                              
                                                              
     
     
     
      printf("\ntotal occurences:%d",searchnum);
      printf("press any key to close...")
      getch();
      
      
      
      }
           
      return 0;
}
thanks again!