Quoting Star Liu <[EMAIL PROTECTED]>:

> I wrote a program to copy the memory content of FFFF0000-FFFFFFFF to a
> file, but it says "Segmentation fault", (i use AMD64 lenny, so the
> address is long), how could i fix it? thanks!

you should only fclose() if Memory != NULL, so your function would be  
better off like this:

void CopyMemoryToFile(char* FilePath, long StartAddress, long OffSet)
{
    FILE* Memory;
    Memory=fopen (FilePath, "w");
    if(Memory!=NULL)
    {
       void* Start;
       Start=StartAddress;
       fwrite(Start, 1, OffSet, Memory);
       fclose(Memory);
    }
}





-- 
coreboot mailing list
[email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to