bladox.com Forum Index bladox.com
Turbo SIM Toolkit Adapter Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem when writting on persistent data

 
Post new topic   Reply to topic    bladox.com Forum Index -> Development
View previous topic :: View next topic  
Author Message
msimplicio



Joined: 18 May 2010
Posts: 3

PostPosted: Wed May 19, 2010 7:51 pm    Post subject: Problem when writting on persistent data Reply with quote

I?m having trouble managing persistent data and EEPROM<->RAM relationships. I want to store an array as persistent data. For this, I defined the following structure:

typedef struct _appData
{
u8 length;
u8 *contents;
}appData

If I make:

u8 i;
u8* edata = emalloc(length);
for(i = 0 ; i < length; i++){
wb(&edata[i], i);
}

I do can read the bytes using ?rb(&edata[i])?. However, if I make (as suggested in the ?fake_sim.c? example):

appData *p = app_data();
ww (&p->contents, edata);

I am unable to read the bytes using ?rb(&p->contents[i])? afterward.

Any ideas on what is wrong?

Thank you!

BR,

Marcos
Back to top
View user's profile Send private message
pz
Guest





PostPosted: Thu May 20, 2010 6:08 am    Post subject: Reply with quote

Read the pointer first, u8 * edata=rw(&p->contents); and then use rb(&edata[i]);
Back to top
msimplicio



Joined: 18 May 2010
Posts: 3

PostPosted: Wed Jun 09, 2010 12:51 pm    Post subject: Reply with quote

It becomes just obvious when you say it...

Thanks a lot for saying it!!! Smile

Marcos.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    bladox.com Forum Index -> Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group