Project

General

Profile

Actions

Bug #13131

closed

ArgumentError: string contains null byte

Added by voobscout (voob scout) over 5 years ago. Updated over 5 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:79081]

Description

Why does this not work?:

IO.binwrite(0.chr, '/tmp/test.txt')

If it's not a bug, then please somebody explain - how strings containing null bytes can be written to disk?

say there's a thermal printer command [29, 49, 75, 2, 0, 49, 120].map(&:chr).join that needs to be part of data sent to print, how would this be accomplished in ruby?

Updated by Eregon (Benoit Daloze) over 5 years ago

  • Status changed from Open to Rejected

You inverted the order of the arguments, it's the filename first:

IO.binwrite('/tmp/test.txt', 0.chr)

Updated by voobscout (voob scout) over 5 years ago

Benoit Daloze wrote:

You inverted the order of the arguments, it's the filename first:

IO.binwrite('/tmp/test.txt', 0.chr)

Dear Sir! Thank you so much!

Actions

Also available in: Atom PDF