[R] Problem with pdf, png, jpeg devices and files named CON on Window s
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Jan 15 15:13:28 CET 2007
This is a restriction of the ISO C interface to the Windows API. E.g.
'check' says
## Furthermore, Uwe Ligges says that Windows still does not allow
## the following DOS device names (by themselves or with possible
## extensions):
##
## Name Function
## ---- --------
## CON Keyboard and display
## PRN System list device, usually a parallel port
## AUX Auxiliary device, usually a serial port
## CLOCK$ System real-time clock
## NUL Bit-bucket device
## COM1 First serial communications port
## COM2 Second serial communications port
## COM3 Third serial communications port
## COM4 Fourth serial communications port
## LPT1 First parallel printer port
## LPT2 Second parallel printer port
## LPT3 Third parallel printer port
Windows Explorer seems to have a different set of rules, disallowing a lot
of valid names (e.g. .Rprofile) but allowing some invalid ones.
On Mon, 15 Jan 2007, Brandt, T. (Tobias) wrote:
> Hi
>
> I cannot seem to create any files that have the name "CON" before the file
> extension, i.e. all of the following fail:
>
>> pdf("CON.pdf")
> Error in pdf("CON.pdf") : unable to start device pdf
>> jpeg('CON.jpeg')
> Error in jpeg("CON.jpeg") : unable to start device devWindows
>> png('CON.png')
> Error in png("CON.png") : unable to start device devWindows
>> sink('CON.txt')
> Error in file(file, ifelse(append, "a", "w")) :
> unable to open connection
>>
>
> Any filename other than this works fine.
>
>> png('ICON.png')
>> dev.off()
> null device
> 1
>> png('CON1.png')
>> dev.off()
> null device
> 1
>> sink('log.txt')
>> sink()
>>
>
> Remembering that in the old DOS days, commands like 'copy CON myfile.bat'
> were common, I suspected that this has something to do with CON being a
> reserved word so I tried to create the files manually in Windows explorer.
> Creating files named 'CON.png', 'CON.pdf', 'CON.txt' all work fine. However
> I did notice that Windows won't let me create a file named just "CON".
> However since the devices that I'm trying to create have extensions, I don't
> understand why they fail.
>
> Who can help?
>
> Thanks
> Tobias
>
>
>> version
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status
> major 2
> minor 3.1
> year 2006
> month 06
> day 01
> svn rev 38247
> language R
> version.string Version 2.3.1 (2006-06-01)
>>
>
>> Sys.info()
> sysname release
> version nodename
> "Windows" "NT 5.1" "(build 2600)
> Service Pack 2"
> machine login
> user
> "x86"
>>
>
> ********************
> Nedbank Limited Reg No 1951/000009/06. The following link displays the names of the Nedbank Board of Directors and Company Secretary. [ http://www.nedbank.co.za/terms/DirectorsNedbank.htm ]
> This email is confidential and is intended for the addressee only. The following link will take you to Nedbank's legal notice. [ http://www.nedbank.co.za/terms/EmailDisclaimer.htm ]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list