CalculiX  2.13
A Free Software Three-Dimensional Structural Finite Element Program
frecord.c File Reference
#include <unistd.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <pthread.h>
#include "CalculiX.h"
#include "readfrd.h"
Include dependency graph for frecord.c:

Go to the source code of this file.

Functions

int frecord (FILE *handle1, char *string)
 

Function Documentation

◆ frecord()

int frecord ( FILE *  handle1,
char *  string 
)
18 {
19  register int i, n, c;
20 
21  for (i=0; i<MAX_LINE_LENGTH-1; i++)
22  {
23  string[i] = getc(handle1);
24  if (string[i] == '\n')
25  {
26  for (n=i+1; n<MAX_LINE_LENGTH; ++n) string[n] = '\0';
27  return(i);
28  }
29  if (string[i] == '\r')
30  {
31  c = getc(handle1);
32  if (c != '\n')
33  ungetc(c, handle1);
34 
35  for (n=i+1; n<MAX_LINE_LENGTH; ++n) string[n] = '\0';
36  return(i);
37  }
38  else if (string[i] == (char)EOF)
39  {
40  for (n=i+1; n<MAX_LINE_LENGTH; ++n) string[n] = '\0';
41  return(i);
42  }
43  }
44  string[MAX_LINE_LENGTH-1] = '\0';
45  return(MAX_LINE_LENGTH-1);
46 }
#define MAX_LINE_LENGTH
Definition: readfrd.h:10
Hosted by OpenAircraft.com, (Michigan UAV, LLC)