Pages: [1]   Go Down
Author Topic: Renameing a file with SdFat  (Read 2675 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 3
Posts: 77
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I mistyped when I asked this question regarding RTClib.  That would be quite a trick

I need to rename a file on SD card after it is detected and used to configure the device.  I see no way to directly rename a file.  Perhaps copy to a new name and delete the old one, but I see nothing to use to copy either.  Two files open at once for a byte by byte copy seems like a bad idea.

Any suggestions?

Thanks,

JAC
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49384
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can read more than one byte at a time. Given that SdFat is not a full-blown file system, copy and delete seems to be the only way to accomplish what you want to do.
Logged

0
Offline Offline
Jr. Member
**
Karma: 3
Posts: 77
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can one have more than a single file open at a once, or is it an open-seek-read-close  ---- open/append-write-close dance?

Not a big deal really, just seems kind of grubby.  Everything else in SdFat works like a champ.

Thanks,

JAC
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49384
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Can one have more than a single file open at a once, or is it an open-seek-read-close  ---- open/append-write-close dance?
You'll let us know when you try, right?
Logged

0
Offline Offline
Jr. Member
**
Karma: 3
Posts: 77
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A buffer-full at a time works fine.  It took less time to do it than to complain about it

jac
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49384
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Excellent. If you make a function out of it, it becomes re-usable. You might even post the function here, for others that want to do something similar.
Logged

Pages: [1]   Go Up
Jump to: