aboutsummaryrefslogtreecommitdiff
path: root/broccoli
diff options
context:
space:
mode:
authorRobin Krahl <guskraro@student.gu.se>2017-10-19 12:07:06 +0000
committerRobin Krahl <guskraro@student.gu.se>2017-10-19 12:07:06 +0000
commitfe201f91aa4562441159a61fe8ac0a0a061d8d1a (patch)
tree6f091de2cdd49f1de954bf436ec6e5aba78281f5 /broccoli
parent800874873c93403a83fffbd8493b8e7f154c21fb (diff)
downloadmidbro-fe201f91aa4562441159a61fe8ac0a0a061d8d1a.tar.gz
midbro-fe201f91aa4562441159a61fe8ac0a0a061d8d1a.tar.bz2
pasad: Flush files after writing
Diffstat (limited to 'broccoli')
-rw-r--r--broccoli/src/pasad.c9
1 files changed, 6 insertions, 3 deletions
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);