Re: [Rd] Invalid connection after closing?

From: Joris Meys <jorismeys_at_gmail.com>
Date: Fri, 08 Apr 2011 17:14:08 +0200

Thx for the information. I read it, but I wasn't sure what was going on inside. Is there a way to close a connection without destroying it? Guess not, but you never know...

Cheers
Joris

On Fri, Apr 8, 2011 at 5:09 PM, Duncan Murdoch <murdoch.duncan_at_gmail.com> wrote:
> On 08/04/2011 10:56 AM, Joris Meys wrote:
>>
>> Dear all,
>>
>> I do not completely understand following behaviour :
>>
>> >  con<- file("test.txt")
>> >  isOpen(con)
>> [1] FALSE
>> >  open(con)
>> >  isOpen(con)
>> [1] TRUE
>> >  close(con)
>> >  isOpen(con)
>> Error in isOpen(con) : invalid connection
>> >  str(con)
>> Classes 'file', 'connection'  atomic [1:1] 3
>>   ..- attr(*, "conn_id")=<externalptr>
>>
>> Why do I get an error, indicating an invalid connection, after I
>> closed a connection? Is this to be expected?
>
> Quoting ?close: " ‘close’ closes and destroys a connection. " In the current
> implementation, connections are a finite resource, and you need to be able
> to get rid of them when you are done. close(con) is the way to do that. If
> you want to re-open it, you need to remember the filename (or extract it
> before calling close()), and issue another call to file().
>
> Duncan Murdoch
>

-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

tel : +32 9 264 59 87
Joris.Meys_at_Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri 08 Apr 2011 - 15:30:36 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 Fri 08 Apr 2011 - 16:30:43 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