Use of System() function to execute shell command " Echo "
Hello,
I want to execute following command using system() function to write value "1" as string in a file.
The command that I am passing to system() as a string is:-
"echo 1 > /sys/class/gpio/goio14/value".
I want to write value 1 in the file "/sys/class/gpio/goio14/value". Also want to use system function() to execute the command.
When I am executing system() command, I am not getting any error but if I open the file and check for the file,file contains the older value that is 0 and new value is not getting written in the file.
I am not able to figure what the problem is. When program execution comes to the point of system() function
I am getting following message:
sh: can't create /sys/class/gpio/goio14/value: nonexistent directory
But the file "value" is already present at the mentioned path.
Any help regarding the same would be appreciated.
Thank You in advance.
|