Re: [Rd] writting null (\000 or ^@) to an external text file without the new warning

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Tue, 28 Oct 2008 15:32:12 -0600

Thanks, I had assumed that writeChar("",con) would write 0 bytes to the file and had seen the other construct somewhere else. A quick test of writeChar("",con) does have the ^@ (when viewed in emacs) in the correct place, and there were no warnings, so I will change to that.

Thanks again,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow_at_imail.org
801.408.8111



> -----Original Message-----
> From: Simon Urbanek [mailto:simon.urbanek_at_r-project.org]
> Sent: Tuesday, October 28, 2008 3:20 PM
> To: Greg Snow
> Cc: R-devel_at_r-project.org
> Subject: Re: [Rd] writting null (\000 or ^@) to an external text file
> without the new warning
>
>
> On Oct 28, 2008, at 14:23 , Greg Snow wrote:
>
> > I have some functions that write an external text file for
> > postprocessing by another program. Some instructions to the other
> > program need to be indicated by null values (\000 or ^@). The
> > function currently uses code like:
> >
> > writeChar(rawToChar(as.raw(0)), con)
> >
> > where con is a connection to the file. Previous to version 2.8.0
> > this worked fine. With 2.8.0 it still works, but I get a warning
> > message about "truncating string with embedded null: '\0'" every
> > time. This is documented and not a bug, but I still find it
> annoying.
> >
>
> Well, why don't you just use
> writeChar("", con)
> that's what you're actually calling anyway since rawToChar(as.raw(0))
> is exactly "" as it gets truncated.
>
> Cheers,
> S
>
>
>
> > One thing I could do is to turn off all warnings before doing this,
> > but then if there is some other warning generated, then I will miss
> > the other warning(s).
> >
> > Is there a better way to write the null to the text file? Or is
> > there a way to suppress just this warning without suppressing any
> > other warnings that may occur?
> >
> > Thanks,
> >
> > --
> > Gregory (Greg) L. Snow Ph.D.
> > Statistical Data Center
> > Intermountain Healthcare
> > greg.snow_at_imail.org
> > 801.408.8111
> >
> > ______________________________________________
> > R-devel_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
> >
______________________________________________ R-devel_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue 28 Oct 2008 - 21:35:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 29 Oct 2008 - 12:30:46 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive