R
Richard Bos
James Kuyper said:I have to disagree - it is very much the same thing. Is it eating if I
open my mouth but take in no food? Is it typing if I put my hands into
position to type, but hit no keys? Is it running if I get in position to
start a race, but never move? Then how can my program be reading if it
takes in no data from the file?
If you eat agar-agar, you will get no nutrients from it whatsoever, but
you still eat. If you run on a treadmill, you'll get nowhere fast, but
you're still running. Similarly, if you read from /dev/null, you get no
data, but you still read. By contrast, if you try to read from
/doesnotexist, you won't read.
The OP asked for a file that nobody can read. To me, that means that
nobody is allowed to open it for reading, not that nobody will get any
data from the file.
The latter is very easy to achieve in ISO C: create a file and write
nothing to it. If no other program writes to your file either, a
subsequent read will return no data. However, you can still open the
file _for_ reading. Moreover, nobody will get data from that file, and
that nobody includes you.
The former is impossible using ISO C alone, but using C-plus-some-
extension, you can create a file that contains data, and which you can
open and read that data, but nobody else can even open the file. Using
C-plus-some-more-extensions, it can even be possible to make sure that
nobody but you can see the file at all, making it hard for others to
even _try_ to read it.
Those are two quite different situation, and I'd only call the situation
where others cannot read the file _at all_ "nobody can read it".
Richard