Copy and paste a file on SDcard?

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Contact:

Copy and paste a file on SDcard?

Post by RobH »

Can anyone give pointers on copying and pasting a file from an SDcard to the same SDcard? I have been in a discussion with my Flowcode sparring partner about it today (we're both learning FC) and I think you have to do it in steps, like:

write file1 name to string1
make file2 name with string2 (modified string derived from string1 )
open file1 and copy contents to string3
open file2 and write string3

Thanks,
-Rob

User avatar
Benj
Matrix Staff
Posts: 14950
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Copy and paste a file on SDcard?

Post by Benj »

Hi Rob,

Which version of Flowcode are you using?

In v5.5 and v6 I added a option for simultaneous files to be manipulated allowing you to copy from one file to another without having to keep: opening file A, moving to the next uncopied sector, reading the data, opening file B, moving to the next free sector, writing the data.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Contact:

Re: Copy and paste a file on SDcard?

Post by RobH »

FC6 trial, PIC pack, and soon to be Pro pack. I'm loving this programming environment, btw!

User avatar
Benj
Matrix Staff
Posts: 14950
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Copy and paste a file on SDcard?

Post by Benj »

Hello Rob,

Here is a quick example I've put together. Not tested it but I think it should work ok.
Attachments
FAT File Copy.fcfx
(12.71 KiB) Downloaded 88 times

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Contact:

Re: Copy and paste a file on SDcard?

Post by RobH »

Thanks Ben. I'll check this out today.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Contact:

Re: Copy and paste a file on SDcard?

Post by RobH »

I checked you code and it kind of works, if you run the simulation twice. The first run of the simulation will successfully make the text file but doesn't add the text therein. If you run a second time, it will write the text. I haven't tried it on real hardware yet.

-Rob

User avatar
Benj
Matrix Staff
Posts: 14950
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Copy and paste a file on SDcard?

Post by Benj »

Hi Rob,

That's interesting, wonder if you need a delay just after creating the file for the sim to work correctly first time.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Contact:

Re: Copy and paste a file on SDcard?

Post by RobH »

That's what I was going to try next. I'll let you know what I come up with...

Post Reply