Go Down

Topic: Writing a binary file to SD. (Read 1 time) previous topic - next topic

ndobie

I am trying to build a data logger but rather than using a text file I want it to use a binary file. Is there a library that is available that can already do binary file writes similar to that of C/C++. The plan is to just have the Arduino append the senor readings onto a file contained on a SD card. Then I can pull the SD card and use a computer program, most likely written in C++, to analyze the data.

PaulS

In the SD library, the function to write to a file takes as an argument a const void * (a pointer to the data, of any type, to write to the file).

If doesn't care what is in that array - binary or ascii (not that there is really a difference). It just copies the data to the file.

MarkT

This is true of pretty much all filesystems on all operating systems I know of...  A file is a vector of bytes, nothing in the filesystem code should care what those bytes are, or what they represent.  To the filesystem code "binary file" and "text file" is a meaningless distinction.
[ I won't respond to messages, use the forum please ]

Go Up