Question with routine...
Heya all!
I almost have this delete thing working right, except for one thing - it
doesn't clean up the bytes at the end of the file. How would I do this?
(And like the routine, I need to keep the memory usage extremely
low)
TIA,
--"LEVIATHAN"
-- Code...
include file.e
object junk
procedure delete_data(sequence path, integer
offset, integer bytes)
--delete data n at offset
integer fn,gap,c,fpos,offsetcounter
offsetcounter = offset-1
fn=open(path,"ub")
junk = seek(fn,-1)
fpos=where(fn)
junk = seek(fn,offset)
-- move end of file
for x=where(fn)+bytes to fpos by 1 do
offsetcounter = offsetcounter+1
junk = seek(fn,x)
c=getc(fn)
junk = seek(fn,offsetcounter)
puts(fn,c)
flush(fn)
end for
close(fn)
end procedure
-- end code...
|
Not Categorized, Please Help
|
|