/* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- */


#include <extUtil.h>


/* liest einen Record bis '\n'; uebergibt Anzahl gelesene Zeichen */
int frecord( FILE *handle1,  unsigned char *string)
{
  register int i, n;

  for (i=0; i<MAX_LINE_LENGTH-1; i++)
  {
    string[i] = getc(handle1);
    if ((string[i] == '\n')||(string[i] == 13))
      {
      for (n=i+1; n<MAX_LINE_LENGTH; ++n) string[n] = (unsigned char)NULL;
      return(i);
      }
    else if (string[i] == (unsigned char)EOF)
      {
      for (n=i+1; n<MAX_LINE_LENGTH; ++n) string[n] = (unsigned char)NULL;
      return(i);
      }
  }
  string[MAX_LINE_LENGTH-1] = (unsigned char)NULL;
  return(MAX_LINE_LENGTH-1);
}


