Get the App
SLTechnology News&Howtos  ›  Development  › 

How to call other programs and get program output in Go language

Shulou Source: shulou.com Published: 2022-06-03 19:32:31 11月12日 Update

This article mainly introduces the Go language how to call other programs and get the program output, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.

The specific implementation methods are as follows:

Package mainimport ("exec" / / "os/exec" in go1 "fmt") func main () {cmd: = exec.Command ("ls", "- l") buf,err: = cmd.Output () fmt.Printf ("% s\ n% s", buf,err)} Thank you for reading this article carefully I hope the article "how to call other programs and get program output in Go language" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Programs articles language output value interest at the same time methods more friends knowledge editing industry information information channels channels references learning help support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL vpn NVidia OPPO Reno macOS