Product Logo

CNS Menu

Dynamic Menus




Reads in the characters or lines of a file.

Return TypeText
FormatCNSMenu_File_Read ( File ; Start ; Amount ; ReadLines )
Required Parameters

The path and file name of the file you want to read.

Optional Parameters

The starting character position or line. If negative, the position will be relative to the end of the file. [Default is 0.]


The number of characters or lines to read. [Default is all or the remaining part of the file.]


If True, the start and amount parameters refer to the number of lines instead of characters. [Default is False.]

Example 1

Reads in all the data from the Data.txt file.

CNSMenu_File_Read ( "~/Desktop/Data.txt" )
Example 2

Reads in 10 characters of data from the Data.txt file starting with the 4th character. Note, the first character of the file is in position 0, which is why you get the 4th character when using a value of 3 as the Start parameter.

CNSMenu_File_Read ( "C:\Users\Bob\Desktop\Data.txt"; 3; 10 )
Example 3

Reads in all the data from the Data.txt file using the ReadLines option.

CNSMenu_File_Read ( "C:\Users\Bob\Desktop\Data.txt"; ""; ""; True )