From fe201f91aa4562441159a61fe8ac0a0a061d8d1a Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Thu, 19 Oct 2017 12:07:06 +0000 Subject: pasad: Flush files after writing --- broccoli/src/pasad.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'broccoli/src/pasad.c') diff --git a/broccoli/src/pasad.c b/broccoli/src/pasad.c index c506410..58dc9ab 100644 --- a/broccoli/src/pasad.c +++ b/broccoli/src/pasad.c @@ -40,9 +40,6 @@ int main(int argc, char **argv) int L = atoi(argv[2]); int r = atoi(argv[3]); - FILE *file_sensor = fopen("sensor.dat", "w"); - FILE *file_distance = fopen("distance.dat", "w"); - /* Arrays and variables */ int sL=86336; double s[sL]; @@ -107,6 +104,9 @@ int main(int argc, char **argv) product_Xt_X = sum; sum = 0; + FILE *file_sensor = fopen("sensor.dat", "w"); + FILE *file_distance = fopen("distance.dat", "w"); + begin = clock(); while(1) { @@ -141,6 +141,9 @@ int main(int argc, char **argv) printf("%lf\n",dist); fprintf(file_distance, "%lf\n", dist); + + fflush(file_sensor); + fflush(file_distance); } fclose(file_sensor); -- cgit v1.2.3