how to create a file with copy/read denied to it

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
 
R

Richard Bos

jameskuyper said:
I agree that there is a difference. *"" has a value of 0, while *
(char*)NULL has undefined behavior. However, I wouldn't describe
either expression as "retrieving a character from a string".

I would - the first case, that is. And the result is the terminating
null _character_.
Which means that there was nothing read, but no error occurred.

Exactly. There was a read operation, which read no data. Which is a very
different thing from there never being a read operation at all.

Richard
 
R

Richard Bos

Golden California Girls said:
Funny, I consider the kernel to be an other.

I refer the *honourable gentleman to the remark, often attributed to
Lincoln, concerning dogs, tails and numbers of legs.

Richard
 
O

Old Wolf

How can i write a file such that no body can read it or copy it.
I wan to create abc.c in a /tmp kind of temporary location. Compile it
and have a.out generated and remove abc.c. But at the end I don't want
to leave a trace about how a.out was created. That is abc.c needs to
be deleted at the end.

A bit off-topic, but do you really need to
create a file? Some compilers let you pipe
in the source to be compiled.
 
R

Richard Bos

Richard said:
It would appear to the keen c.l.c watcher that during Heathfield's
catastrophic wane and fall from grace that Mr Bos is pushing forward to
stake his case for the crown and sceptre due to c.l.c's most pretentious
and precious contributor.

Imprimis, I am not pushing forwards towards anything, here; secundis, I
am no more nor any less pretentions than I have been from yore.
Still, at least it won't cost so much : only the sir name need be
painted over and re-written.

Tertiis, I'm Dutch, not British, so HMQEII is not likely to knight me
any time soon.

Richard
 
K

Kenny McCormack

Imprimis, I am not pushing forwards towards anything, here; secundis, I
am no more nor any less pretentions than I have been from yore.


Tertiis, I'm Dutch, not British, so HMQEII is not likely to knight me
any time soon.

Richard

Bravo! It is important, in CLC, to keep one's sense of humor.

Heathfield, for all his faults, does at least understand this.

What truly isolates Kiki and Chuckie is the fact that they simply have
no concept of humor (and thus how silly they look).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top