DEV Community

Cover image for You have been zigged (series) : About system function from stdlib.h
Black Tornado
Black Tornado

Posted on

You have been zigged (series) : About system function from stdlib.h

The 12th program uses system function from stdlib.h. This function is not available in zig. Zig users are supposed to use std.process.run() and std.process.spawn() functions instead because its more safer. If you really really want to execute commands using shell injection you can pass the string "sh" before the command in argv array (code from blog 11) like .argv = &.{ "sh", "-c", "ls", "-l" }.

Thanks for reading. To be continued.

Top comments (0)