# File lib/backports/tools/io.rb, line 44
  def self.write(binary, filename, string, offset, options)
    offset, options = nil, offset if offset.respond_to?(:to_hash) && options == Backports::Undefined
    options = {} if options == Backports::Undefined
    options = coerce_to_hash(options)
    File.open(filename, 'a+'){} if offset # insure existence
    options = {:mode => offset.nil? ? "w" : "r+"}.merge(options)
    args = options[:open_args] || [options]
    File.open(filename, *Backports.combine_mode_perm_and_option(*args)) do |f|
      f.binmode if binary && f.respond_to?(:binmode)
      f.seek(offset) unless offset.nil?
      f.write(string)
    end
  end