ReadStringFromFile

From GECK
Jump to: navigation, search


A function added by the JIP NVSE Plugin.

Description

Reads the contents of the specified file and stores them in a string variable.

  • If startAtLine is specified, the file will be read beginning from that line number (otherwise, it will be read from line 1).
  • If lineCount is specified, only that number of lines will be read.

Syntax

[help]
(string_var) ReadStringFromFile filePath:string startAtLine:int lineCount:int

Example

ReadStringFromFile "data_file.txt"
ReadStringFromFile "data_file.txt" 10 8 

Notes

  • filePath is relative to the game's installation path.
  • Before calling this, make sure the file exists using FileExists. CAUTION: FileExists is relative the Data folder, not the Game's installation path.
  • Maximum length of a file is 16384 characters. Any data over that point will not be read, even if lineCount and StartAtLine are specified.

See Also