10 years, 5 months ago.

Writing to local file system and sd file system simulteneously

Hi, does anyone know how to build a program that writes data to local file and sd file system at the same time? Most preferably if anyone uses the 'fprintf' function. Thanks!

1 Answer

10 years, 5 months ago.

Do you mean at the same time as really both writing something at the same time, or just that they are both used in your program, and first you write to one, and then to the other one?

First one would be challenging, second one should simply be combining example programs for SD file system and local file system.

I have tried combining both programs together however when an error occurred when I tried to build it as it prompt me on using the same function 'fp' for both processes.

Is there any other protocol to the function 'fp' that I can use to differentiate between both file system. I have tried using 'fs' to differentiate but it is invalid

FILE *fp = fopen("/local/Barolog.txt", "a");

posted by KV LING 25 Dec 2013

fp is simply a pointer to the specific file you are trying to open. Changing it to another name should work fine, or plan B, just use fp = fopen after the first time where you use FILE *fp. (Only do that if you have closed the previous file you opened, otherwise use plan A). If that doesn't work post some more code :)

posted by Erik - 25 Dec 2013