Mega Code Archive

 
Categories / Ruby / File Directory
 

You need to specify the full path for the file unless the file is in the current working directory

file1 = File.new("Sample", "r") # Thus the preceding statement should be written as: file1 = File.new("C:\\Ruby\\Sample", "r") file1.close