IloOplInputFile
See the Overview for a general presentation of the ILOG Script extensions for OPL.
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");
}
}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
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
IloOplInputFile(path)
|
| Field Attributes | Field Name and Description |
|---|---|
| flow control |
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 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 |
readline()
Reads one line from the input file.
|
true if the file has been entirely read and is at end of file (eof).
true if the file exists.
true if the file is currently open.
Raises an error if the file does not exist.