What should be the reason for not working linux system function properly?

60 views Asked by At

I'm checking one condition in my application where if the condition satisfies my job is to send one trap notification using the following command

snmptrap -c public -v 2c 192.168.1.104 "" 1.3.6.1.4.1.53864.1.4.0

so in my application I was using function system as follows

system("snmptrap -c public -v 2c 192.168.1.104 "" 1.3.6.1.4.1.53864.1.4.0");

but after using the system function I'm getting an error and the strange part is if I try to use the same command snmptrap -c public -v 2c 192.168.1.104 "" 1.3.6.1.4.1.53864.1.4.0 in the console then it is working perfectly fine. Can anyone help me understand the reason behind this?

1

There are 1 answers

0
Omkar Dixit On BEST ANSWER

Thanks to @G.M for the solution So the following command worked for me

system("snmptrap -c public -v 2c 192.168.1.104 \"\" 1.3.6.1.4.1.53864.1.4.0");