mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 12:32:21 +00:00
17 lines
343 B
Go
17 lines
343 B
Go
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
|
|
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
|
|
|
package main
|
|
|
|
//#include <stdio.h>
|
|
import "C"
|
|
import "unsafe"
|
|
|
|
func main() {
|
|
buf := NewMyBuffer(1024)
|
|
defer buf.Delete()
|
|
|
|
copy(buf.Data(), []byte("hello\x00"))
|
|
C.puts((*C.char)(unsafe.Pointer(&(buf.Data()[0]))))
|
|
}
|