marcioh 0 Newbie Poster

Hi everbody!

Sample problem:
program1 has a poiter that point to a block memory in PC memory.
program1 write the address of block memory (the pointer) in hard disk.
program1 still run.
program2 start.
program2 read the pointer (address of block memory) in the hard disk.
Now program1 and program2 have pointers with same value. But the pointers not point to same point in the PC memory!

The question remain: How can I share a memory block between applications?

Extense problem:
The code for prog1:
#include <stdio.h>
int main()
{
char *p,str[]="here I am!";
FILE *fp;
p=str;
printf("%p %d\n%s\n",p,sizeof(p),p);
fp=fopen("address.bin","wb");
fwrite(&p,sizeof(char *), 1,fp);
fclose(fp);
while(0x01);
return(0);
};

The code for prog2:
#include <stdio.h>
int main()
{
char *p;
FILE *fp;
fp=fopen("address.bin","rb");
fread(&p,sizeof(char *),1,fp);
fclose(fp);
printf("%p %d\n%s\n",p,sizeof(p),p);
return(0);
};

We expect that prog2 print out "here I am!".
But It not do!

ps.: excuse me by my bad english.

Dave Sinkula commented: Use code tags. +0