Hi, I am new to Ruby and come form C language. Can someone pint out for me my mistake please. It seem not to find the file ever no regardless of the path. class Scan attr_reader :filename, :alpha_count, :digit_count, :non_printable_count, :line_count, :word_count, :symbol_count attr_writer :filename, :alpha_count, :digit_count, :non_printable_count, :line_count, :word_count, :symbol_count filed_ptr=0 def initialize(filename) @filename=filename @alpha_count=0 @digit_count=0 @symbol_count=0 @non_printable_count=0 @blank_count=0 @line_count=0 @word_count=0 end #initialize def open_count printf( "filenamae= %s\n",@filename) file_ptr=File.open(@filename,"r") do |file| file.each_byte do |ch| case ch.to_i when 32 @blank +=1 when 0..31 @non_printtable_count+=1 when 48..57 @digit_count +=1 when 65..90 ,97..122 @alpha_count +=1 when -1 puts "Found End of file" else @symbol_count +=1 end #case end #each_byte file_ptr.close end #open end #open_count end #class print "Enter the path and file name ej. /home/user1/file.txt :->" fname=gets ff=Scan.new(fname) ff.open_count() -- Posted via http://www.ruby-forum.com/.