Declare variables as FAR but variable lost after reset or power off

Hi, I declared array as follow:

typedef struct{ unsigned char name[NAME_LEN+1]; unsigned int age;


far Member_t * PtrToFamilyMemberFile = 0; far char * FamilyMemberFilePtr = 0;

void FamilyMember_Initalization(void) { FamilyMemberFilePtr = (far char*) xalloc( sizeof(long) +

1L*MAX_MEMBERS*sizeof(Member_t) );

PtrToFamilyMemberFile = (far Member_t*)(FamilyMemberFilePtr + 4); *((far long*)FamilyMemberFilePtr) = 1L*MAX_MEMBERS*sizeof(Member_t); // Size of data section

_f_memset( PtrToFamilyMemberFile, 0, 1L*MAX_MEMBERS*sizeof(Member_t) ); // Clear data


Whenever I wish to store to this value, I would do the following:

_f_strcpy(PtrToFamilyMemberFile[2].name,"Elizabeth"); or PtrToFamilyMemberFile[2].age = 23;

Everything works fine but if I reset or remove power, all stored data are lost. What am I doing wrong?

--------------------------------------- Posted through

formatting link

Reply to
Loading thread data ...

You have told us nothng about the hardware in use or why you think declaring something as far is enough to guarantee persistent memory.

IOW, you need to provide a _lot_ more information than you currently have done. :-)


Simon Clubley, 
Microsoft: Bringing you 1980s technology to a 21st century world
Reply to
Simon Clubley

Also check all your include files, in case "far" has been defined as an empty string on most architectures.

Of course, if this is some 8086 architecture...

Reply to

**SPECIFICALLY**, what makes you think the data should NOT be lost?
Reply to
Don Y

(Member_t); //


First, you're tossing a bunch of obviously proprietary function calls at us without telling us what tool set or processor you're using. This is like asking how many cylinders your car has without telling us make & model.

Second, in tool sets where "far" is recognized at all, it's a way of addressing "big" RAM memories, not a way of addressing non-volatile memory.


  • Tell us what the processor is
  • Tell us what the tool chain is
  • Tell us where you expect things to be stored on power-down ("I don't know" is a valid answer to this question).

Perhaps we can help from there.

Tim Wescott 
Wescott Design Services 
 Click to see the full signature
Reply to
Tim Wescott

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.