// LoadHistory loads from file with given filename. Returns non-nil error on fail.
func LoadHistory(filename string) error { // int linenoiseHistoryLoad(char *filename);
	filenameCString := C.CString(filename)
	res := C.linenoiseHistoryLoad(filenameCString)
	C.free(unsafe.Pointer(filenameCString))
	if res != 0 {
		return errors.New("Could not load history from file.")
	}
	return nil
}
Beispiel #2
0
func HistoryLoad(filename string) {
	f := C.CString(filename)
	defer C.free(unsafe.Pointer(f))
	C.linenoiseHistoryLoad(f)
	return
}