Ruby File Handling Programs

In Ruby programming language, a File is an abstraction of any file object accessible by the program and is closely associated with class IO.

This section contains Ruby file handling programs, practice these Ruby programs to learn the concept of Ruby file handling, these programs contain the solved code, outputs, and the detailed explanation of the statements, functions used in the Ruby file handling programs.

List of Ruby File Handling Programs

  1. Ruby program to create an empty file
  2. Ruby program to write text into the file
  3. Ruby program to read entire text from the existing file
  4. Ruby program to read lines from the existing file
  5. Ruby program to read the specified number of characters from the existing file
  6. Ruby program to open a file in read-only mode
  7. Ruby program to open a file in write-only mode
  8. Ruby program to open a file in the read-write mode without truncating the file
  9. Ruby program to open a file in read-write mode with truncating file
  10. Ruby program to open a file in append mode
  11. Ruby program to open a file in append mode, open if the file does not exist
  12. Ruby program to rename a specified file by another name
  13. Ruby program to check a specified file is exist or not
  14. Ruby program to check a file has readable permission or not
  15. Ruby program to check a file has writable permission or not


Comments and Discussions!


Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.