Project

General

Profile

Actions

Bug #9431

closed

In windows ruby IO.write returns count of bytes without count of CR character

Added by bdimych (Dmitry Bolshakov) almost 11 years ago. Updated over 2 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
Backport:
[ruby-core:59876]

Description

C:\Users\bdimych>ruby -e "p IO.write('temp.txt', %Q(123\n)); p File.size('temp.txt')"
4
5

imho it looks unexpected

Updated by mame (Yusuke Endoh) over 2 years ago

  • Status changed from Open to Rejected
  • Backport deleted (1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN)

I believe this is a spec of Windows. Ruby's IO interface is based on C's stdio, and I confirmed that fwrite("Hello\n", 1, 6, fp) returns 6 and actually outputs 7 bytes on Windows with cl.exe.

Actions

Also available in: Atom PDF

Like0
Like0