home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-04-13 | 1.3 KB | 64 lines | [TEXT/ttxt] |
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- -- Originally written by Emmanuel CECCHET --
- --
- class STD_FILE_READ_WRITE
- --
- inherit
- STD_FILE_READ
- undefine connect_to, disconnect
- redefine read_character, end_of_input
- end;
- STD_FILE_WRITE
- redefine connect_to, put_character
- end;
-
- creation connect_to
-
- feature
-
- connect_to(new_path: STRING) is
- local
- rewrite_fic : STD_FILE_WRITE ;
- do
- mode := "r+";
- input_stream := fopen(new_path,mode);
- if input_stream /= Void then
- path := new_path;
- output_stream := input_stream;
- end;
- end;
-
- read_character is
- local
- err: INTEGER;
- do
- err := fflush(output_stream);
- last_character_memory := fgetc(input_stream);
- end;
-
- put_character(c: CHARACTER) is
- local
- err: CHARACTER;
- err2: INTEGER;
- do
- err2 := fflush(output_stream);
- err := fputc(c,output_stream);
- if err /= c then
- std_error.put_string("Error while writing character.");
- crash;
- end;
- end;
-
- end_of_input: BOOLEAN is
- local
- err: INTEGER;
- do
- err := fflush(output_stream);
- Result := feof(input_stream)
- end;
-
- end -- STD_FILE_READ_WRITE
-
-