| class FILE < $OSTREAM |
|---|
| **** | Buffered file. Uses the C standard "FILE". To avoid buffering penalties, read or write entire files using an FSTR. For systems which do funny things for linefeeds and cntl-z, this is a text file, not a binary finle, for which you should use BFILE.
___f:_FILE_:=__FILE::open_for_read("test_file"); ___line:_STR_:=_f.get_line;_--_gets_the_next_line __ A more convenient way to parse files is to read them into a string and then use a STR_CURSOR on them. This may even have significantly better performance ___f2:_FILE_:=_FILE::open_for_read("test_file"); ___whole_file:_STR_:=_f2.str;__--_The_whole_file_as_a_string ___cursor:_STR_CURSOR_:=_whole_file.cursor; ___next_integer:_INT_:=_cursor.get_int;_--_Get_an_integer_from_the_file _____________________--_string ___next_word:_STR_:=_cursor.get_word;____--_Read_a_word_from_the_file _ |
| $OSTREAM |
| attr fp:EXT_OB; |
|---|
| **** | The FILE pointer attr |
| buffer_size(sz:INT) |
|---|
| **** | Set buffer size to `sz' bytes. Must be called after a file is opened but before reading or writing. |
| clear |
|---|
| **** | resets end_seen and error status. Built-in. |
| close |
|---|
| **** | Close the file corresponding to self. |
| create_directory(nm:STR) |
|---|
| **** | Make a directory with the path `nm'. |
| current_directory:STR |
|---|
| **** | Absolute path of the current directory. |
| current_loc:INT |
|---|
| **** | The current location in the file. |
| delete(nm:STR) |
|---|
| **** | Delete a file. |
| eof:BOOL |
|---|
| **** | true if EOF has been encountered. Cleared by "clear". |
| error:BOOL |
|---|
| **** | true is an error has occurred with this file. Cleared by "clear". |
| flush |
|---|
| **** | Forces write of any buffered data. |
| fstr(start,msize:INT):FSTR |
|---|
| **** | A string buffer of size at most `msize' containing successive characters from self beginning at `start'.
The number of characters read may be less than 'msize' if end-of-file was encountered or some characters have been discarded due to system-specific conversions. |
| fstr:FSTR |
|---|
| **** | A string buffer containing the contents of self.
Due to conversions on some systems, the number of characters read may be less than the total number of characters in the file. |
| get_char:CHAR |
|---|
| get_line:FSTR |
|---|
| **** | A string buffer containing the characters up to the next newline. |
| get_str:STR |
|---|
| **** | A string containing the characters up to the next newline. |
| get_up_to(sc:CHAR):STR |
|---|
| **** | A string buffer containing the characters up to the next c. |
| open_for_append(nm:STR):SAME |
|---|
| **** | A new object representing the file named `nm' accessible for appending. File is created if not existing. |
| open_for_read(nm:STR):SAME |
|---|
| **** | A new object representing the file named `nm' accessible for reading. |
| open_for_update(nm:STR):SAME |
|---|
| **** | A new object representing the file named `nm' accessible for reading and writing. |
| open_for_update_appending(nm:STR):SAME |
|---|
| **** | A new object representing the file named `nm' accessible for reading and appending. File is created if not existing. |
| open_for_update_truncating(nm:STR):SAME |
|---|
| **** | A new object representing the file named `nm' accessible for reading and writing. File is truncated if existing. |
| open_for_write(nm:STR):SAME |
|---|
| **** | Create a new file with name `nm' and default permissions. File is truncated and opened for writing. |
| plus(c:CHAR) |
|---|
| plus(c:CHAR):SAME |
|---|
| plus(s:FSTR) |
|---|
| **** | Append the string "s" to the file |
| plus(s:FSTR):SAME |
|---|
| plus(s:STR) |
|---|
| **** | Append the string "s" to the file |
| plus(s:STR):SAME |
|---|
| plus(s:$STR) |
|---|
| **** | Append the $STR "s" to the file |
| plus(s:$STR):SAME |
|---|
| resolve_path(fn:STR):STR |
|---|
| **** | Path with ".", "..", and any symbolic links resolved. NOT IMPLEMENTED CORRECTLY. |
| seek_from_current(off:INT) |
|---|
| **** | Attempt to move `off' characters forward. |
| seek_from_end(off:INT) |
|---|
| **** | Attempt to move `off' characters back from the end of self. |
| seek_from_front(off:INT) |
|---|
| **** | Attempt to move to character `off' in self. |
| size:INT |
|---|
| **** | The size of self in characters. -1 for error. |
| stderr:SAME |
|---|
| **** | A file object for stderr. |
| stderr_macro:EXT_OB |
|---|
| stdin:SAME |
|---|
| **** | A file object for stdin. |
| stdin_macro:EXT_OB |
|---|
| stdout:SAME |
|---|
| **** | A file object for stdout. |
| stdout_macro:EXT_OB |
|---|
| str: STR |
|---|
| temp_file:SAME |
|---|
| **** | Open a temporary file for writing. It will be deleted automatically when the process terminates. |
| temp_filename(prefix:STR):STR |
|---|
| **** | Generate a unique name somewhere appropriate. |
| attr fp:EXT_OB; |
|---|
| **** | The FILE pointer attr |
| fwrite_fstr(f:FSTR,sz:INT,fp:EXT_OB):INT |
|---|
| **** | Built in |
| fwrite_str(f:STR,sz:INT,fp:EXT_OB):INT |
|---|
| **** | Built in |