Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geertjohan/cgo.wchar
The cgo.wchar package is to be used with go/cgo and helps with the conversion from and to C.wchar_t and wchar_t strings (*C.wchar_t with null terminator or length int).
https://github.com/geertjohan/cgo.wchar
Last synced: 3 months ago
JSON representation
The cgo.wchar package is to be used with go/cgo and helps with the conversion from and to C.wchar_t and wchar_t strings (*C.wchar_t with null terminator or length int).
- Host: GitHub
- URL: https://github.com/geertjohan/cgo.wchar
- Owner: GeertJohan
- Created: 2013-03-26T23:21:59.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-06-29T08:52:31.000Z (over 9 years ago)
- Last Synced: 2024-06-19T00:32:42.017Z (7 months ago)
- Language: Go
- Homepage:
- Size: 206 KB
- Stars: 14
- Watchers: 5
- Forks: 11
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## cgo.wchar
Helps with using wchars with cgo.
### Example
Example from the go.hid library:
```go
func (dev *Device) ManufacturerString() (string, error) {
// create WcharString
ws := wchar.NewWcharString(100)// retrieve manufacturer string from hid
res := C.hid_get_manufacturer_string(dev.hidHandle, (*C.wchar_t)(ws.Pointer()), 100)
if res != 0 {
return "", dev.lastError()
}// get WcharString as Go string
str := ws.GoString()// all done
return str, nil
}
```