This is the documentation for the development version.
There are no official binaries for it; build it from the source code in git.
Download links on these pages work only after the release.
For the current release, see version 7.0.
IO::OpenFile
- IO::OpenFile(fileName, openingMode) ⇒ FILE
-
Open file. Returns FILE object or null.
In server scripts,
IO::functions are available only if server configuration variableNXSL.EnableFileIOFunctionsis enabled (change requires server restart). They are always available in scripts run bynxscript.In addition, a script that runs on behalf of a user (see Scripts Started by a User) needs the "Access server file system from scripts" system access right, and scripts in read-only script contexts cannot use
IO::functions whileScripts.RestrictWriteAccessis enabled. A denied call returnsnullwithout a script error.Table 1. Parameters fileName
String
File name to open.
openingMode
String
Optional, default
"r". Mode file should be opened in. More can be found there.ReturnFile class or
NULLif error occurred.f = IO::OpenFile("/tmp/a.txt", "r"); while (!f.eof) println(f.readLine()); // Will print contents of the file