Files
the-way-to-go_ZH_CN/eBook/examples/chapter_3/CandGo/c2.go
2013-04-20 22:19:12 -04:00

14 lines
216 B
Go

// c2.go
package print
// #include <stdio.h>
// #include <stdlib.h>
import "C"
import "unsafe"
func Print(s string) {
cs := C.CString(s)
defer C.free(unsafe.Pointer(cs))
C.fputs(cs, (*C.FILE)(C.stdout))
}