libsvm icon indicating copy to clipboard operation
libsvm copied to clipboard

Load and save from a memory buffer

Open jondo opened this issue 10 years ago • 1 comments

I want to manage a model database without using temporary files. For this, I propose an API extension:

int svm_save_model_buffer(const char *model_buffer, int buffer_length, const struct svm_model *model);
struct svm_model *svm_load_model_buffer(const char *model_buffer, int buffer_length);

svm_save_model_buffer saves a model to a buffer; returns the written size on success, or -1 if an error occurs.

svm_load_model_buffer returns a pointer to the model read from the buffer, or a null pointer if the model could not be loaded.

jondo avatar Aug 26 '14 10:08 jondo

+1

This also should have a function to request the buffer length for purposes of allocating the buffer, however.

UserAB1236872 avatar Sep 13 '16 12:09 UserAB1236872