'Load contents of a raw binary file to memory
Usage:
MYNAME file address [size]'

def loadmem(self, *arg):

    mem = ''
    (filename, address, size) = normalize_argv(arg, 3)
    address = to_int(address)
    size = to_int(size)
    if (filename is not None):
        try:
            mem = open(filename, 'rb').read()
        except:
            pass
        if (mem == ''):
            error_msg('cannot    read    data    or    filename    is    empty')
            return
        if ((size is not None) and (size < len(mem))):
            mem = mem[:size]
        bytes = peda.writemem(address, mem)
        if (bytes > 0):
            msg(('Written    %d    bytes    to    0x%x' % (bytes, address)))
        else:
            warning_msg('failed    to    load    filename    to    memory')
    else:
        self._missing_argument()
    return
