Skip to main content
PREV CLASS NEXT CLASS FRAMES NO FRAMES

 

Class IloOplInputFile

IloOplInputFile

Description:

See the Overview for a general presentation of the ILOG Script extensions for OPL.

Example:
execute {
   var f = new IloOplInputFile("output.txt");
   if (f.exists) {
     writeln("the file output.txt exists");
     var s;
     while (!f.eof) {
      s=f.readline();
      writeln(s);
     }
     f.close();
   } else { 
     writeln("the file output.txt doesn't exist");
   }
}
If the file output.txt has previously been created (for the file's content see the example in IloOplOutputFile)
the file output.txt exists
Hello World
another line
Iterating properties:
Empty iteration.
Index resolution:
Default behavior.
Available for:
flow control

Constructor Summary
Constructor Attributes Constructor Name and Description
 
Property Summary
Field Attributes Field Name and Description
flow control
eof
Returns true if the file has been entirely read and is at end of file (eof).
flow control
Returns true if the file exists.
flow control
Returns true if the file is currently open.
Method Summary
Method Attributes Method Name and Description
flow control
close()
Closes the input file.
flow control
open(path)
Opens the file on the given path.
flow control
Reads one line from the input file.
Constructor Detail
IloOplInputFile
IloOplInputFile(path)
Parameters:
path - Optional: The path of the file to open.
Property Detail
eof
{boolean} eof
Returns true if the file has been entirely read and is at end of file (eof).
Available for:
flow control

exists
{boolean} exists
Returns true if the file exists.
Available for:
flow control

isOpen
{boolean} isOpen
Returns true if the file is currently open.
Deprecated:
replaced by exists
Available for:
flow control
Method Detail
close
close()
Closes the input file.
Available for:
flow control

open
open(path)
Opens the file on the given path.

Raises an error if the file does not exist.

Parameters:
path - The path of the file to open.
Deprecated:
The file is automatically opened when needed.
Available for:
flow control

readline
{string} readline()
Reads one line from the input file.
Returns:
The line read.
Available for:
flow control

©Copyright IBM Corp. 1987-2011.