Stdlib in legato project


#1

Hello.
I used mangoh green with wp8540.
i connect to green whith ssh and creat file “/home/root/tt”
I creat project in legato.
and i want read this file. But i not open him.
my code:

COMPONENT_INIT
{
LE_INFO(“Hello, world.”);

FILE* fd;

fd = fopen ("/home/root/tt", "r"); 

if (fd == 0) {
	LE_INFO ("ERR OPEN\n");
	return;
}

}

What is problem?
How to fix it?


#2

Hi zuuuuk,
Please try modify .adef file of your project with below:

Option 1, disable sandbox:

sandboxed: false

For more info: https://docs.legato.io/latest/defFilesAdef.html#defFilesAdef_sandboxed

Option 2, mount the file for Legato app:

requires:
{
file:
{
/home/root/tt /home/root/tt
}
}

For more info: https://docs.legato.io/latest/defFilesAdef.html#defFilesAdef_requiresFile

Then rebuild and try again.

Hope it helps.
Thx