question

95504669 avatar image
1 Vote"
95504669 asked 95504669 rolled back

Opening a created file in Azure sphere

Hi, I have been trying to save few data on a json file that I created in the application.
94682-image.png

But I found out that the <stdio.h> did not contain fopen function.
94590-image.png

1) How can I open a file before storing data in that file?
2) Is it possible to send a .json file through UART?

Please let me know if there are any other method to store data in json file if this doesn't work.

Thank you.


azure-sphere
image.png (18.0 KiB)
image.png (62.3 KiB)
image.png (62.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

matsujirushi avatar image
1 Vote"
matsujirushi answered matsujirushi commented

Hi @95504669 ,
Azure Sphere applications have limited access to the file system.
If you want to attach data file, please see here. https://docs.microsoft.com/en-us/azure-sphere/app-development/storage

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for your response @matsujirushi . Attaching a seperate file is only mentioned in read-only storage.
But I want to update the values of the file even after deployment. But it's not possible in read-only storage.
In Mutable storage, there's no explanation on adding a file.

I have to update the data in the file even after deployment. Can I do that?
Thank you.

1 Vote 1 ·

Hi @95504669 ,
I see.
How about making the application read from read-only storage when it cannot read from mutable storage?

0 Votes 0 ·
ChandraNekanti-3683 avatar image
2 Votes"
ChandraNekanti-3683 answered

Hi @95504669 - Here's a sample that shows how to open and update a file in mutable storage.

https://github.com/Azure/azure-sphere-samples/tree/master/Samples/MutableStorage

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

95504669 avatar image
0 Votes"
95504669 answered 95504669 rolled back

Thank you @matsujirushi and @ChandraNekanti-3683

95107-image.png



Here it's given that file gets deleted when the application gets deleted. So that means , if I recover the device both the application and file will be deleted. And when I deploy the same application , the mutable file will be again created .

These data in the mutable storage can be updated after deployment. Right?
Correct me if I'm wrong.



image.png (57.9 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.