TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Richard Illes
from: Thomas Seeling
date: 1995-08-20 13:14:32
subject: tidbits

Hallo, Richard!

*** Am Mittwoch 16. August 1995 um 01:07 schrieb Richard Illes an All:

 RI> While porting a program from unix to CSet/2 I found out the original
 RI> code did a fopen().. then later performed a fclose() and called a
 RI> routine which did fprintf() to that fopen FILE pointer..
This is definitely a programming error, nothing to blame the compiler for.
What do you expect to happen when writing to a closed file?

 RI>  the original unix code worked fine,
but you don't expect that the contents of the buffer written after closing
the file will ever appear in the file?

 RI> code, Visual C zero's out the FILE pointer after a fclose() and any
I cannot imagine that. The prototype is "int fclose(FILE *)", so
how should it be possible to zero the pointer itself? To do what you tell
here, it would have to be something like "int fclose(FILE **)".

 RI> further fprintf() to this pointer causes nothing to happen..
fprintf(NULL,...) should cause an exception, not "nothing".

 RI>  CSet just leaves the FILE pointer a mess which causes a trap on
 RI> fprintf().
This is up to the compiler implementors.

 RI> Is there a way to really kill a process/session?
Huh? Is this related to the same problem?


Tschau...Thomas

--- E3-32/1.11-32/2.50+
* Origin: TeX-Box +49-6034-1455 ZyXEL 16800 24h (2:244/1130.42)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 244/1130 24/999 2/777 105/42 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.