Go Down

Topic: Calculating csv file size (Read 5495 times) previous topic - next topic


I am logging sensor data to a scv file. I need to calculate the size of this csv file before sending it over to the serial port.

any one with experience on this......


Can you be more specific?

What OS?
What is in the CSV?
How many fields?
What datatype is every field?
How do you want to send the data?
- binary/ascii
- uncompressed/compressed
- otherwise

The more you tell about the problem the better help you get

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


Where is the csv file stored? If the csv file is on an SD card, the SD library has a way to determine the size of a file.
The art of getting good answers lies in asking good questions.


i would like to send data to a satellite modem in binary format. So to successfully send the message, the modem has to know the  length, in bytes, of the message the arduino is sending.

Are you planning to send the whole file in one package? That will require reading the whole file, and storing it in SRAM, of which you have only 2048 bytes (and the SD library needs 512+ of them). If so, simply count the characters as you read them from the file (you'll need to do that to store them in the correct place in the array, anyway).

If not, and this is the more likely scenario, then the size of the csv file is irrelevant. It is the size of the package that you need to know. And, that depends on how you want to package data to be sent. Maybe, one record at a time. Of course, this requires that you know what a record looks like (i.e. when it ends).
The art of getting good answers lies in asking good questions.


End address - Start Address = size

Sorry for being so short, but it's not like you provided a lot of info...
This... is a hobby.


End address - Start Address = size

sp. "(End address - Start Address) + 1 = size"   ;)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.


Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Threads merged.

- Moderator
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

Go Up