Skip to content

Commit

Permalink
Need to flush files before truncating
Browse files Browse the repository at this point in the history
  • Loading branch information
calebj0seph committed Feb 21, 2016
1 parent 1c1cbc8 commit e81a725
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions newline.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ int main(int argc, char** argv) {
);
}
free(buffer);
fflush(file);
truncate(file);
}
if(args.verbose) {
Expand Down
1 change: 1 addition & 0 deletions trim.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ bool trim_file(FILE* in_file, FILE* out_file, enum NewlineType newline_type,
}
}

fflush(out_file);
if(changes_made) {
truncate(out_file);
}
Expand Down

0 comments on commit e81a725

Please sign in to comment.