Commit c13ca34a authored by Johan Richard's avatar Johan Richard
Browse files

Check for end of line in multiples

parent 9e24dd0f
......@@ -43,7 +43,7 @@ void f_shape( long int *istart,
// Read the input arclet file
NPRINTF(stderr, "READ: %s\n", name);
IN = fopen(name, "r");
IN = fopen(name, "r+");
// Info on the file format
switch (flag)
......@@ -67,6 +67,15 @@ void f_shape( long int *istart,
exit(-1);
}
// check whether the file ends with a newline character as expected
char c;
fseek(IN, -1, SEEK_END);
fread(&c,1,1,IN);
if(c != '\n')
fprintf(IN,"\n");
fseek(IN, 0, SEEK_SET);
while ( fgets(line, 256, IN) != NULL && !feof(IN) && !ferror(IN) && !e_scan )
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment