:orphan: .. **************************************************************************** .. CUI .. .. The Advanced Framework for Simulation, Integration, and Modeling (AFSIM) .. .. The use, dissemination or disclosure of data in this file is subject to .. limitation or restriction. See accompanying README and LICENSE for details. .. **************************************************************************** FileIO ------ .. class:: FileIO inherits Object :constructible: :class:`FileIO` is a script object for reading and writing files. Methods ======= .. method:: bool Open(string aFileName) bool Open(string aFileName, string aMode) bool Open(Path aFileName) bool Open(Path aFileName, string aMode) Opens aFileName in the appropriate mode. If mode is not specified or unrecognized the default behavior Input is used. Mode: * in - Read Only **Default** * out - Write Only If the file already exists, it will be overwritten. * append - Write Only Begins writing a new file, or appends to an existing file Returns true if the file was opened successfully; false otherwise. .. method:: void Close() Closes the file and clears the buffer. .. method:: string Readln() Returns the next line of data. .. method:: string ReadToken() Returns the next token (word) of data. .. method:: bool Eof() Returns true if no more data remains to be read. .. method:: string Mode() Returns a string indicating the current mode for a file that has been opened. The following values are possible. * in * out * append * none If a file is not open, "none" will be returned. .. method:: Path Path() Returns a :class:`Path` object of the path used to open the file, as provided via the :method:`FileIO.Open` method "aFileName" argument. If a file is not open at the time of this call, the path will be empty. .. method:: void Write(string aString) Writes aString to the file. .. method:: void Writeln(string aString) Writes aString to the file followed by a carriage return. Important to note that this Writeln is not the same as the scripting language writeln. Writeln follows the c language convention.