Files
the-way-to-go_ZH_CN/eBook/examples/chapter_3/CandGo/c2.go
2015-03-03 12:25:25 -05:00

14 lines
229 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))
}