Skip to content

Instantly share code, notes, and snippets.

@domgetter
Created August 14, 2013 03:30
Show Gist options
  • Save domgetter/6227770 to your computer and use it in GitHub Desktop.
Save domgetter/6227770 to your computer and use it in GitHub Desktop.
> ruby pos_test.rb
First position: 0
Got char: R
Second position: 1
Got char: I
Final position: 2
file = File.new("test.wav", "rt")
puts "First position: #{file.pos}"
char = file.getc
puts "Got char: #{char}"
puts "Second position: #{file.pos}"
char = file.getc
puts "Got char: #{char}"
puts "Final position: #{file.pos}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment