How to open a file with the memory address instead the filename (path)

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

How to open a file with the memory address instead the filename (path)

I can’t reach a solution to the next problem:

I have a C program that open a file with the function fopen

fp= fopen( ‘ filename ‘, ‘r’); In a computer “filename” could be
c://doc/text.txt.

However I am trying to run the same C program in a PC Board (FPGA) with a
PowerPC microproccesador, which is capable of run C programs, and the file
that I want to open is in a DDR memory and begins for example in the memory
address 0x10000000.

How could I fill the pointer fp FILE *fp
In order to the program works as in a computer.

Teh short answer is that you can't use FILE* to access a memory based buffer. Instead, use direct memory access: char * p = (char *) 0x10000000;

And then read the data from the pointer. In some platforms you can map a file to the system's RAM. In this case, you use FILE * etc., but you need to use a few explicit system calls that open the physical file and map its content to a memory address.