Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created January 17, 2019 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/7558e06a47471e156729e0e62cda3f03 to your computer and use it in GitHub Desktop.
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
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.
=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