Created
January 17, 2019 16:07
-
-
Save parzibyte/7558e06a47471e156729e0e62cda3f03 to your computer and use it in GitHub Desktop.
Leer todo el contenido del archivo created by parzibyte - https://repl.it/@parzibyte/Leer-todo-el-contenido-del-archivo
This file contains 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
Hola, soy un archivo de texto para demostrar algunos tutoriales de parzibyte.me. Puedo contener cualquier tipo de contenido, por ejemplo, saltos, | |
tabulaciones | |
y cualquier | |
otra | |
cosa. |
This file contains 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
=begin | |
Leer todo el contenido de un fichero con Ruby | |
@author parzibyte | |
=end | |
NOMBRE_ARCHIVO = "archivo.txt" | |
# Abrirlo en modo lectura | |
open(NOMBRE_ARCHIVO, "r") do |archivo| | |
# Llamar a read sin longitud, para leerlo completo | |
contenido = archivo.read() | |
puts "El contenido es: #{contenido}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment