/* Collection of code snippets by Arne Vajhøj */
/* (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) */
#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
   printf("C (text, line) - %s\n", argv[1]);
   FILE *fp = fopen(argv[1], "r");
   char line[80];
   while(fgets(line, sizeof(line), fp))
   {
      int ix = strlen(line) - 1;
      if(line[ix] == '\n') line[ix] = 0;
      printf("|%s| %d\n", line, strlen(line));
   }
   fclose(fp);
}
