* ruby
* ruby
* ruby
* ganas de programar
... les debo las instrucciones ...
Codigo terminado:
class App
def main( args )
filename = args[0]
expresion = args[1]
if filename == nil
return
end
blocksize = ( args[2] || 1 ).to_i
init = (args[3] || 0).to_i
fin = (args[4] || 10).to_i
File.open(filename, "rb+") do |file|
i = init
while ( i < fin )
file.pos = i
stream = file.read(blocksize)
origstream = stream.clone
eval(expresion)
if stream != origstream
file.pos = i
file.write(stream)
end
i=i+1
end
end
end
end
App.new.main(ARGV)
No hay comentarios:
Publicar un comentario