Can some body know a function that removes white spaces in begining and end and also removes '\n' or '\0' from a file in C language

commented: Make your own thread about it. -2

In C language the fgets() function will trim leading and trailing spaces from words read. It will also skip over '\n'. Text files do not contain '\0' bytes; if your file does then it is not a text file.

In C language the fgets() function will trim leading and trailing spaces from words read. It will also skip over '\n'. Text files do not contain '\0' bytes; if your file does then it is not a text file.

may be you are confused with fread().

fgets will read line by line from a file.it will read until the \n. or length spefied which comes 1st.

Here is your function for sting lrtrim:

/*****THIS FUNCTION IS USED TO REMOVE SPACES FROM THE LEFT AND RIGHT OF A STING*******
|       EXAMPLE
|       -------
|       Input String:"    i am going to school     "
|       Output String:"i am going to school"
*************************************************************************************/


char* str_lrtrim(char *base_str)
 {
  int len=strlen(base_str);
  int i=0;

  if(base_str==NULL)
        return NULL;

  while(isspace(base_str[len-1]))
        {
          base_str[len-1]='\0';
          len--;
        }
  while(isspace(base_str[i]))base_str++;

 return base_str;
}


/******************************END str_lrtrim()*********************************/
commented: Nope, no free cookies here. -3
commented: This is the second post I've seen tonight where you GIVE code away. We do not give code here, we help them code it themselves. -4