// SaveHistory saves from file with given filename. Returns non-nil error on fail.
func SaveHistory(filename string) error { // int linenoiseHistorySave(char *filename);
	filenameCString := C.CString(filename)
	res := C.linenoiseHistorySave(filenameCString)
	C.free(unsafe.Pointer(filenameCString))
	if res != 0 {
		return errors.New("Could not save history to file.")
	}
	return nil
}
Exemple #2
0
func HistorySave(filename string) {
	f := C.CString(filename)
	defer C.free(unsafe.Pointer(f))
	C.linenoiseHistorySave(f)
	return
}