Re: Tr: Re: Save gtkliststore
- From: Peter <hpklett hotmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Tr: Re: Save gtkliststore
- Date: Mon, 06 Mar 2006 13:23:01 -0700
Pascal Bellicano wrote:
I don't see exactly what you mean..
Iterate with which pointer ? Which struct is
concerned
?? How have I to start and when to stop ? Why will
it
be diffrent to write than to read ?
You speak about fileformat ? I only know 2 : binary
and text.. I thought about gnomedb too because my
app
should work on multiple station on the same files..
It would be really great if you could give some
examples and explain the problem of fileformats too.
Thank you a lot
You'll be using GtkTreeIter *. Please look at the API docs
http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeModel.html. These
should always be your first resource. As far as file formats, I think
he's referring to whether you want to save normal C structures to disk,
save some kind of line-by-line thing, use XML, use SQLLite, etc. XML is
extremely versatile, but it can be kind of tricky to learn. Check out a
parser like the following: http://www.xmlsoft.org/. Your basic structure
will be:
OPENING:
Access the file for reading
for each item in file
append item to treeview
Close the file
SAVING:
Access the file for writing
for each item in treeview
append item to file
Close the file
Again, the API docs are your friend.
--- Ignacio Martín <newwen gmail com> a écrit :
You should iterate through the list and get all
the
values you want to
store and write them. In order to read them out,
you
should parse them
(fscanf comes handy here). Think on the best file
format for you. Try
it, it is easy. If you don't get results, ask
again
;)
2006/3/6, Bellicano Pascal
<pascal_bellicano yahoo fr>:
Hello,
I am a beginner in c programming and in gtk..
However, using glade an
anjuta and with a lot
of effort, I have now a little usable app with
gtkliststore (viewed with
model and tree, of course).
Here is my problem :
Is there a way to save a complete list or tree
***without parsing it*** ?
It's perhaps trivial for an exprienced
developper...
I tried it without success ..
void sauver_liste_courtier(const gchar
*filename)
{
FILE *fp;
fp = fopen(filename,"w");
fwrite(courtiers_list,
sizeof(courtiers_list), 1, fp);
fclose(fp);
}
void charger_liste_courtier (const gchar
*filename)
{
FILE *fp;
fp = fopen(filename,"r");
fread(courtiers_list,
sizeof(courtiers_list), 1, fp);
fclose(fp);
}
courtiers_list is *gtkliststore var
Remember, I am a bad programmer for now.. Please
explain me how to do
exactly.
Thank you
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___________________________________________________________________________
Nouveau : téléphonez moins cher avec Yahoo!
Messenger. Appelez le monde entier à partir de 0,012
€/minute !
Téléchargez sur http://fr.messenger.yahoo.com
___________________________________________________________________________
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la
France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]