#include <stdio.h>

int main(void){
   int n = 0;
   char* tmp;
   FILE* fp = fopen("./testfile", "r");
   getline(&tmp, &n, fp);
   printf("got a str of: %s\n", tmp);
   printf("now fp is: %s\n", (fp==NULL)? "null" : "not null");
   fclose(fp);
   free(tmp);
   return 0;
} 


syntax highlighted by Code2HTML, v. 0.9.1