views:

87

answers:

1

I am taking a stream of readings from the GPS controller and storing them in an array, and occasionally writing the readings in the array to a file.

Should I keep the file handle to the file open, or open and close the file each write? And how much does this matter in the scheme of power consumption?

+2  A: 

Once a file pointer is open, there shouldn't really be any computational overhead or extra battery use in keeping it open. On the contrary, opening and closing the file handle will probably use more power, opening and closing locks, etc.

tmh