Re: get.e

new topic     » goto parent     » topic index » view thread      » older message » newer message

For what its worth, here is the routine I use to red an entire file into a
sequence...
global function ReadFile(sequence pFileName)
    integer lFH
    sequence lData

    lFH = open(pFileName,"rb")
    if lFH = -1 then
        return -1
    end if

    machine_proc(19, {lFH,-1})
    lData = repeat(0, machine_func(20, lFH))
    machine_proc(19, {lFH,0})

    for i = 1 to length(lData) do
        lData[i] = getc(lFH)
    end for
    close(lFH)

    return lData
end function



Note that machine routine 19 is 'seek' and 20 is 'where'. I did it this way to
avoid the tiny overhead of including file.e and using it's routine.

On my machine this reads a 64 Meg file in around 1.4 seconds.

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu