On Fri, 7 Sep 2012 18:00:48 +0530
Dinesh Devaraj <din...@emo2.com> wrote:

> /*
> * File: FirstEet.c
> * Author: root
> *
> * Created on September 7, 2012, 6:39 PM
> */
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include <Eina.h>
> #include <Eet.h>
> 
> /*
> *
>  */
> 
> int main(int argc, char** argv) {
> 
> eina_init();
> eet_init();
> 
> //----- Crating a new EET descriptor starts -----//
> 
> typedef struct {
> int Id;
> char *szName;
> Eina_List *label;
> Eina_Bool bGender;
> } PERSON;
> 
> /* Step 01 : declaration of the description handle */
> Eet_Data_Descriptor *des;
> /* Step 02 : declaration of the description class variable */
> Eet_Data_Descriptor_Class eddc;
> /* Step 03 : initializing the description class including the
> * data structure to the description class */
> EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, PERSON);
> /* Step 04 : registering the new description class to get the
> * description handle */
> des = eet_data_descriptor_stream_new(&eddc);
> /* Step 05 : binding the members to the data description */
> EET_DATA_DESCRIPTOR_ADD_BASIC(des, PERSON, "Id", Id, EET_T_INT);
> EET_DATA_DESCRIPTOR_ADD_BASIC(des, PERSON, "szName", szName, EET_T_STRING);
> EET_DATA_DESCRIPTOR_ADD_BASIC(des, PERSON, "bGender", bGender, EET_T_INT);
> EET_DATA_DESCRIPTOR_ADD_BASIC(des, PERSON, "label", label, EET_G_LIST);
> 
> /* Step 06 : declaring a variable to the data structure */
> PERSON *Student;
> 
> /* Step 07 : opening a EET file */
> Eet_File *ef = eet_open("DesEet.eet", EET_FILE_MODE_READ_WRITE);
> 
> int write = 1;
> /* Step 08 : write/read the data structure to the EET file */
> if (write) {
> Student = (PERSON *) malloc(sizeof (PERSON));
> Student->Id = 5;
> Student->szName = "SomeOne";
> Student->bGender = 0;
> Student->label = NULL;
> Student->label = eina_list_append(Student->label, (void *) 0x73245);
> Student->label = eina_list_append(Student->label, (void *) 0x95324);
> Student->label = eina_list_append(Student->label, (void *) 0x13643);
> Student->label = eina_list_append(Student->label, (void *) 0x87142);
> Student->label = eina_list_append(Student->label, (void *) 0x59241);
> eet_data_write(ef, des, "ReFKey", Student, 0);
> } else {
> Student = eet_data_read(ef, des, "ReFKey");
> printf(" > Id : %d\n", Student->Id);
> printf(" > Name : %s\n", Student->szName);
> printf(" > Gender : %d\n", Student->bGender);
> void *data;
> Eina_List *temp = NULL;
> EINA_LIST_FOREACH(Student->label, temp, data)
> printf("%p-", data);
> }
> 
> /* Step 09 : close the EET file */
> eet_close(ef);
> 
> /* Step 10 : delete the description handle */
> eet_data_descriptor_free(des);
> 
> //----- Crating a new EET descriptor ends -----//
> 
> eet_shutdown();
> eina_shutdown();
> return (EXIT_SUCCESS);
> }

forwarding this one too...

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to