Date: Fri, 25 Feb 1994 12:49:40 +0100 To: djgpp AT sun DOT soe DOT clarkson DOT edu From: ahelm AT email DOT tuwien DOT ac DOT at (Anton Helm) Subject: fopen() problem Hi ! I run into troubles with fopen() when I try to append to a textfile. 1) There are 2 different kinds of textfiles: a) Textfiles WITH EOF character ( ^Z, 0x1A). b) Textfiles WITHOUT EOF character. Dont ask me why, that is MS-DOS... 2) If I use type b) files -> anything is fine. If I try to use fopen(filename, "a") on a type a) file fprintf() or any other of the output functions will write BEHIND the EOF character. When opening such a file with an editor (or any DOS-command) it will detect the EOF and the text behind (which is actually there) cannot be accessed. 3) Workaround: f = fopen(filename, "a"); fseek(f, -1, 1); if(fgetc(f) == EOF) fseek(f, -1, 1); This would deal with both kinds of textfiles. Is that a feature or a bug ? Maybe it has been discussed before, but I have been removed from the list several times (see below). Tony BTW: I detected this morning, that I have been removed from the mailing list again. It was the 3rd time since 1/1/94. To all who dont believe: 1) I got no message that I have been removed. 2) there were no messages from this list for 5 days. 3) detection method: I sent a delete message to listserv TODAY and got the following reply: >> Per your request >> "delete ahelm AT email DOT tuwien DOT ac DOT at djgpp" >> 'ahelm AT email DOT tuwien DOT ac DOT at' was NOT FOUND on the 'djgpp' mailing list. ============================================================================ Office: ** Private: ** Dipl.-Ing. Anton HELM ** Institut fuer Nachrichtentechnik ** und Hochfrequenztechnik ** Anton HELM Guszhausstr. 25/389 ** Gratian-Marx Str. 7/27 A-1040 Wien ** A-1110 Wien AUSTRIA ** AUSTRIA ** Tel.: +43-1-58801-3520 ** FAX : +43-1-5870583 ** ** ============================================================================ ________ __ __ __ __ __ _______ __ __ /__ __/ / / / / / / / / / / / _____/ / \ / / / / / / / / _____ / / __ / / / / / /____ / /\ \ / / / / / / / / /____/ / / / / / / / / / _____/ / / \ \ / / / / / /___/ / / /__/ /__/ / / / / /____ / / \ \/ / /__/ /_______/ /___________/ /_/ /______/ /_/ \__/ ============================================================================