Documentation Set for Swarm 2.2
Prev | Reference VI. Simtools Library | Next

# InFile [Deprecated]

## Name

InFile -- Class to perform file input.

## Description

Deprecated: Warning: the error return behavior of these methods is fragile, only end of file is reported as an error. It is probably not wise to use use this inteface unless your text processing needs are very simple.

This class is (was) intended to simplify the input file-I/O in Swarm. It essentially deals with the detailed file opening and closing routines thus alleviating the need for C file I/O procedure calls.

## Protocols adopted by InFile

SwarmObject CREATABLE

## Methods

### Phase: Creating

- + create: (id <Zone>)aZone withName: (const char *)theName
  for backward compatibility

- + create: (id <Zone>)aZone setName: (const char *)theName
  This is the create method for InFiles, where theName is, of course the name of the file to open.

### Phase: Using

- - (void)drop
  The drop method must be called when the user wants to close the file. Only by dropping the InFile object will the file truly be closed.

- - (int)skipLine
  Skips a line.

- - (int)unGetChar: (char)aChar
  Returns a character for re-reading.

- - (int)getChar: (char *)aChar
  The getChar: method takes a pointer of type char and loads it with an instance of that type from the open file. In case of failure, the method returns 0.

- - (int)getFloat: (float *)aFloat
  The getFloat: method takes a pointer of type float and loads it with an instance of that type from the open file. In case of failure, the method returns 0.

- - (int)getDouble: (double *)aDouble
  The getDouble: method takes a pointer of type double and loads it with an instance of that type from the open file. In case of failure, the method returns 0.

- - (int)getUnsignedLong: (unsigned long *)anUnsLong
  The getUnsignedLong: method takes a pointer of type unsigned long and loads it with an instance of that type from the open file. In case of failure, the method returns 0.

- - (int)getLong: (long *)aLong
  The getLong: method takes a pointer of type long and loads it with an instance of that type from the open file. In case of failure, the method returns 0.

- - (int)getUnsigned: (unsigned *)anUnsigned
  The getUnsigned: method takes a pointer of type unsigned and loads it with an instance of that type from the open file. In case of failure, the method returns 0.

- - (int)getInt: (int *)anInt
  The getInt: method takes a pointer of type Int and loads it with an instance of that type from the open file. In case of failure, the method returns 0.

- - (int)getLine: (char *)aLine
  The getLine: method loads the argument string with the characters up to, but not including a newline character.

- - (int)getWord: (char *)aWord
  The getWord: method returns a string that does not contain spaces, tabs, and newlines.

Prev | Home | Next
AppendFile [Deprecated] | Up | NSelect