How to run legato terminal commands via a .c file?

Using system() doesnot seem to work.

Eg:
system(“gnss get posInfo”) fails with message:
gnss: not found

I would suggest to use the API directly.

But to use system(), try run with full path, i.e.

system(“/legato/systems/current/bin/gnss get posInfo”)

And reminded to gain access if your app is running inside sandbox.