How to read a string file?



For my C application, i need to read a string file located at /home/root/data.txt (get file contents to a char variable).
After many tries, i not found how to do this.
Can anyone give me an example to how to accomplish this ?

Thanks !


Please see


Hi @pierre.josselin,
If your application is sandboxed, your file is then located in “/legato/system/current/appsWritable/yourApp/home/root/data.txt”.
If you need to access this file, absolute path, then your app should be unsandboxed (config in adef is sandboxed : false).

Hope this helps


Thank you for your answers, I will try this.