wtf? Typo... How do I change it? I have tried but it don't wanna work...
I think you will need to copy the file back onto the SD card at that point.
why does it not say 9856B (or the relevant size) is used when it is full? Why does it say that it is "done"?
Because it actually is full. The file is created by filling it with a single pre-defined start character and the rest with spaces. The file and it's size has to be pre-existing. This library doesn't allow us to create a new file or change the size of any existing files.
The way it works is this... We crate a text file and make the first character a start character that was defined in the library. Then we fill the file after the start character with meaningless data. It could be a space or it could be any character you want. The space is chosen to simply make it easier on the eyes when you look at it in a text editor like notepad or something similiar. At the end of the file is the end of file characters, just as with the start character it's defined in the code. This tells the code where the file ends so that when we read the file contents the reader knows where to stop reading, otherwise it might just read the contents of the entire SD card.
It says that it's done because thats the hard coded string message that was defined by the developer of the library. It simply means that, the current operation has finished.
What are the sectors? How big does the text file have to be to take up more than 1 sector?
according to Wiki on SD cards a sector (aka a block) is 512 bytes. So once you went over 512 bytes you would be using more than one sector.
Also when appending data:
If I append ffffffffff. (full stop to stop appending) then I append gggg. I get ffffffffff (from the first time) and ggggffffff (from the second time). It seems to remember the last appended stuff and write it again whether or not it has been written over (in the buffer? Does it have one or something?)
Also, how do I write a full stop to a text file if it ends the appending of data...
Please post the line of code where you are doing this. I have an idea what's going on but I want to make sure what your doing before I explain the wrong thing.
To write to a different file can I change all of the hola.txt things to .txt and then set i as a number at the start of my sketch. Should this work if all of the numbered text files are already there?
[/quote]
You can accomplish what you are asking but not quite the way you worded it. If the file name is not going to change throughout the sketch, simply add a #define FILE_NAME "1.txt" at the top of your sketch and you should be good to go.
If you want to change the file name in code (ie... a loop) you might try the itoa function to turn the number into it's ascii value and then append the ".txt" when passing in the file name to the print function.