clinuxembedded-linuxsnmp-trap

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


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?


Solution

  • 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");