title: warning: implicit declaration of function 'getline'
body: <p>Hi I'm almost done with a project I have for class. I need to sort the priority of people in an airline based on a few factors. This is my project description: </p>
  
  <p>"An airline company uses the formula shown below to determine the priority of passengers on the
  waiting list for overbooked flights.
  Priority Number = (A / 1000) + B - C
  where
  A is the customer’s total mileage in the past year
  B is the number of years in his or her frequent flier program
  C is a sequence number representing the customer’s arrival position when he or she booked the
  flight.
  Given a file of overbooked customers as shown in the table below, write a program that reads the
  file and determines each customer’s priority number. The program then builds a priority queue
  using the priority number and prints a list of waiting customers in priority sequence."</p>
  
  <p>I feel my code encompasses the main idea, but I am having issues with getline. When I compile the code (shown below) it gives me an error:
  "|24|warning: implicit declaration of function 'getline' [-Wimplicit-function-declaration]|"</p>
  
  <p>Please help me fix this so it will compile. I've tried a lot of things and nothing works.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#define _GNU_SOURCE
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main()
  {
      FILE * fp; //create file pointer to be read later
      char * line = NULL;
      int temp,count=0,len=0,mileage[100],read,years[100],sequence[100],priority[100];
      char name[100][100],tempst[100];
      fp = fopen("customers.txt", "r"); //opening the file
  
      if (fp == NULL)
          exit(EXIT_FAILURE);
      int i;
  
  
  
      while ((read = getline(&amp;line, &amp;len, fp)) != -1) { //start reading file and recording data
          i=0;
  
          while(line[i]!=' ' || (line[i+1]&gt;='A' &amp;&amp; line[i+1]&lt;='z'))
          {
              name[count][i]=line[i];
              i++;
          }
          name[count][i++]='\0';
          mileage[count]=0;
  
          while(line[i]!=' ')
          {
              mileage[count]=mileage[count]*10+(line[i]-'0');
              i++;
          }
          i++;
          years[count]=0;
  
          while(line[i]!=' ')
          {
              years[count]=years[count]*10+(line[i]-'0');
              i++;
          }
          i++;
          sequence[count]=0;
  
          while(line[i]!='\0')
          {
              sequence[count]=sequence[count]*10+(line[i]-'0');
              i++;
          }
          priority[count]=(mileage[count]/1000)+years[count]-sequence[count];
          count++;
  
      }
  
      for( i=0;i&lt;count-1;i++) // calculate priority
      {
          for(int j=i+1;j&lt;count;j++)
          {
              if(priority[i]&lt;priority[j])
              {
                  temp=priority[i];
                  priority[i]=priority[j];
                  priority[j]=temp;
                  strcpy(tempst,name[i]);
                  strcpy(name[i],name[j]);
                  strcpy(name[j],tempst);
              }
          }
      }
  
      for( i=0;i&lt;count;i++) //print priority
      {
          printf("%s %d\n",name[i],priority[i]);
      }
      return 0;
  }
  </code></pre>