I am trying to make two .exe files in c where first one store some data in memory and save data´s pointer to .txt. and second one read pointer from .txt and display them.
first one:
fw = fopen("pointer.txt", "w");
fprintf(fw, "%p", &data);
fclose(fw);
second one:
fr = fopen("pointer.txt", "r");
fscanf(fr, "%p", &pointer);
but when I run the second one it display a random numbers.
what is wrong?
Processes don’t operate on actual memory, but virtual memory allocated to them by the system. So
0x01111from P1 and0x01111from P2 don’t point to the same sector of your RAM. Ergo, no, you need to use IPC I guess.