And thusly Cini, Richard spake:
>
> // Read ROM directly to memory. This works.
> ppmem = &ucMem[roms[i].iROMStart + MEM_ROM] ;
> fread(ppmem, sizeof(byte), roms[i].iROMLen, pFH) ;
>
> //this doesn't work...
> //fread(&ucMem[roms[i].iROMStart + MEM_ROM], sizeof(byte), roms[i].iROMLen,
> pFH) ;
This one _should_ work... Both are returning the address of the memory
location.
>
> //...nor does this
> //fread((char *)ucMem[roms[i].iROMStart + MEM_ROM], sizeof(byte),
> roms[i].iROMLen, pFH) ;
>
This one is only returning the value at roms[i].iROMStart + MEM_ROM in array
ucMem and casting it to a character pointer.
What is happening with the second fread? Are you getting a SIGSEGV?
Cheers,
Bryan
P.S. If you printf the pointer vals (with %p) of ppmem and
&ucMem[roms[i].iROMStart + MEM_ROM] you should get the same address back.
Received on Thu Aug 01 2002 - 08:52:01 BST
This archive was generated by hypermail 2.3.0
: Fri Oct 10 2014 - 23:34:35 BST