Created
November 29, 2011 22:31
-
-
Save orlybg/1406891 to your computer and use it in GitHub Desktop.
Programa que toma un nombre de archivo como argumento de la linea de comando y lee el archivo especificado
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# se usaria ruby reader.rb elarchivito.txt | |
def leeArchivo(archivito) | |
data = '' | |
f = File.open(archivito, "r") | |
f.each_line do |linea| | |
data = data + linea | |
end | |
return data | |
end | |
##### MAIN ##### | |
begin | |
ARGV.each do |argumento| | |
puts "Archivo a leer: #{argumento}" | |
puts leeArchivo(argumento) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment