Mail Archives: djgpp-workers/1999/04/14/05:26:53
On Tue, 13 Apr 1999, Salvador Eduardo Tropea (SET) wrote:
> 1) fork(), the author uses fork just because the command is there, he forks,
> one thread execs another program and the other waits! why? isn't that the
> same that spawn(P_WAIT,... ?
Answer in a nutshell: there *is* no 'spawn' on Unix (including Linux).
spawn and friends are a DOSism.
> 2) The author also does it:
>
> yyin = fopen(preOutName,"r");
> unlink (preOutName);
> if (yyin == NULL) {
>
> What's that?! he opens the file and unlinks it. Is that supposed to work in
> UNIX? I mean: what the program will get from a file that was unliked?
A temporary file that doesn't leave any trace of its existence in the file
system (unlink deletes only the directory entry, if the inode, i.e. the
file itself is still used by someone). Among other tricks, this means
that no other program will have an opportunity to access that same file,
whether by accident or on purpose.
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -