problem with g_io_channel_read_to_end ()



hi
I d like to read a file with this call
If I understood, it reads all the remaining file in one time
here s the function I use :

void fill_buffer(GtkTextBuffer *buffer,GIOChannel *file_desc)
   {
   gint *data_length;
   GIOStatus read_status;
   GError **error;
   gchar **file_data;
g_print("\nFILE DESC : %d\n",(*file)->file_desc); //for debugging read_status=g_io_channel_read_to_end(file_desc,file_data,data_length,error);
   g_print("STATUS READ : %d\n",read_status);

//here comes the call to fill the buffer, later...

   g_io_channel_shutdown(file_desc,TRUE,NULL);
}

here is the log

____________________________________________
FILE DESC : 136119944

(projet:406): GLib-CRITICAL **: file giochannel.c: line 1651 (g_io_channel_read_to_end): assertion `(error == NULL) || (*error == NULL)' failed
STATUS READ : 0
____________________________________________

so, it seems that this function don' t read the file
I don' t know why.
I ve try differents malloc for error and file_data, but unsuccessfully.
From where could come the problem?
Another question why a GError **error ?why a pointer to pointer ? I don ' t understand since it s finally an enum data.


Axel




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]