Saving contents of a textbox...
- From: Evan Lawrence <evan worldpath net>
- To: gtk-list redhat com
- Subject: Saving contents of a textbox...
- Date: Tue, 03 Mar 1998 20:32:22 -0000 (???)
Hiya Gtk people!
Wondering if you could help me on a problem... I'm writing a save
function for a text editor, and the following code technically works, except it
occasionally cuts off the last part of the document - I haven't seen any other
code for this kind of thing so if someone can just point me to an app that
might get me set...
gint gE_file_save(gE_document *document, gchar *filename)
{
int i;
FILE *file_handle;
if ((file_handle = fopen(filename, "w")) == NULL)
{
g_warning ("Unable to save file %s.", filename);
return 1;
}
gtk_text_thaw (GTK_TEXT(document->text)); /* I put this in here hoping
it did some kind of a refresh to the text widget*/
for (i=0; i<=(gtk_text_get_length(GTK_TEXT(document->text))-1); i++)
fputc((int) GTK_TEXT(document->text)->text[i], file_handle);
fclose(file_handle);
gtk_label_set(GTK_LABEL(document->tab_label),
strip_filename(filename)); /* strip_filename() just removes the leading path */
return 0;
}
I really hope I'm not making some blatant mistake that's fix will make me feel
like an idiot, but hey, at this point I'm desparate ;) Any help is *much*
appreciated... Note also that I haven't upgraded to 0.99.4 yet (using the
0.99.3 text widget with the (marius?) patch for deleting line breaks,) so there
might have been a bug fix to gtk_text_get_length, but I didn't see anything
about it on the list... Thanks a mil!
--
Evan Lawrence
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]