Just to help clarify (hopefully) the Unix/Windows "reserved filename".

CON: is similar to Unix's /dev/zero or /dev/null for example -- Files that 
already exist and have OS meaning.

stdout is NOT a reserved filename...it's a predefined variable of FILE *.  You 
cannot say "cp file stdout" on Unix like you can say "copy file con:" on 
Windows.  CON: is a reserve filename.

This program will give you a warning compling about using stdout the variable
#include <stdio.h>
main()
{
        FILE *fp1,*fp2;
        fp1=fopen(stdout,"w");
        if (fp1 == NULL) perror("stdout reserved");
                                else fputs("stdout funky here",fp1);
        fputs("stdout console here\n",stdout);
        fp2=fopen("stdout","w");
        if (fp2 == NULL) perror("stdout file");
        else fputs("stdout file here",fp2);
#ifdef _WIN32
        fp1=fopen("CON","w");
        if (fp1 == NULL) perror("stdout reserved");
        else fputs("stdout windows console here",fp1);
#endif
}

On Unix there are no errors.  Unix allows you to create funky filenames.
Visual Studio Express 2010 produces an error on the open to CON
stdout reserved: Invalid argument
stdout console here
stdout windows console here

Make sure you run this in a temporary working directoy as you'll get a really 
funky filename for fp1.
This will run, and produce two files and the console output (fp1 is actually an 
error in my book but it won't tell you that without more checking like 
"isprint").
fp1 ends up being a funky filname based on *stdout and contains "stdout 
reserved here"
fp2 ends up being a file called "stdout" in the directory and contains "stdout 
file here".



Michael D. Black
Senior Scientist
NG Information Systems
Advanced Analytics Directorate



________________________________________
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Simon Slavin [slav...@bigfraud.org]
Sent: Tuesday, March 29, 2011 6:48 AM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] bug with sqlite

On 29 Mar 2011, at 12:38pm, Arjen Markus wrote:

> is this under Windows? con is one of the reserved file names, dating
> from the DOS days (or even before that).

Bah.  Arjen beat me to it.  Yes 'con' is the filename you used to use when you 
wanted to talk to the CONSOLE: the terminal connected to the front of the 
mainframe rather than one being served using the timesharing system.  It is 
something like what Unix means by 'stdin' and 'stdout'.

>  Other reserved names are aux,
> nul and prn (I think there is a fifth, but I cannot remember that one).

Depends which company's mainframes you used to use.  But I believe some 
versions of DOS carried over LPT1 to LPT9 (line printer), CLOCK$ (a 
pseudo-device which outputs a timer count), and COM1 to COM9 channels (serial 
communications).

> So, that has nothing to do with SQLite itself.

Agreed.  Other operating systems may have no trouble with a file called 'con' 
but have problems with other filenames, for example 'stdout'.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to