Go Down

Topic: uFat empty files (Read 2187 times) previous topic - next topic


Hi all,

This question is mainly for people familiar with a the SDuFat library

I have an SD card breakout board in the mail to me, but I'd like to get some simple questions out of the way so I can get to work once it arrives. I plan on using it for data logging, no reading required, but over the course of ~3 hours of expected use a good amount of ascii data might be generated.
I'm planning on using SDuFat. Question 1: is this a good idea?
If you agree with my library choice, my next question is about the empty files that this library writes to. Checking out the example code, it uses hola.txt, an empty file with a bunch of blank spaces (0x20) culminating with an EOF (0x03). I figure the following should do the trick for a 256 SD card:
Code: [Select]

#include <stdio.h>

int main(void)
int i;
FILE *myfile = fopen("emptyfile.txt", "wb");
for (i=0;i<(268435456 - 1);i++) //256mb minus 1 byte
putc(0x20, myfile);
putc(0x03, myfile); //the extra byte
return 0;

The file does end up being 256mb (exactly), but when I open it in a text editor, mine looks completely empty, whereas the empty example file "hola.txt" begins with a character that looks like an L. Do you have any idea why their hola.txt has this "L" character, and why mine doesn't?

Go Up