Re: [Rd] Writing character vectors with embedded nulls to a connection

2006-03-31 Thread Prof Brian Ripley
The following approach sobject <- charToRaw(serialize(object,NULL)) len <- length(sobject) writeBin(sobject, outcon) would appear to work. As from 2.3.0 you will then be able to do unserialize(readBin(incon, "raw", n=len)) On Fri, 31 Mar 2006, Prof Brian Ripley wrote: > I think you should be

Re: [Rd] Writing character vectors with embedded nulls to a connection

2006-03-30 Thread Prof Brian Ripley
I think you should be using a raw type to hold such data in R. It is not intentional that readChar handles embedded nuls (and in fact it might not in an MBCS). As ?serialize says For 'serialize', 'NULL' unless 'connection=NULL', when the result is stored in the first element of a c