logo       

Re: ruby 1.8.6 puts outputs \000 chars: msg#02311

ruby-talk

Subject: Re: ruby 1.8.6 puts outputs \000 chars

On Thu, Jul 30, 2009 at 11:35 AM, John<jhs408@xxxxxxxxx> wrote:
> I recently updated my gem library, now a simple program outputs \000
> chars.
> What has changed and is causing the \000 after each char output ?
> And how to correct the problem.
>
> Thanks for the help.
>
> ----- Snippet of input file:
> aalib-ruby (0.7.1)
>    Author: Patrick Mahoney
>    Homepage: http://aalib-ruby.rubyforge.org/
>
> ----- lister.rb  program
>
> t= IO.readlines("gems2.txt")
> puts "hello".inspect
> puts t[0].inspect        #print 1st line of file
>
> --- output from lister.rb
>
> C:\Users\spanton\Documents\GemList>ruby lister.rb
> "hello"
> "a\000a\000l\000i\000b\000-\000r\000u\000b\000y\000 \000
> (\0000\000.\0007\000.\00
> 01\000)\000\r\000\n"

Hmmmm, my first guess is that the null characters really ARE in the
file "gems2.txt"

perhaps it changed since the last time you ran the program?
--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

Google Custom Search

News | Mail Home | sitemap | FAQ | advertise