type: ifstream
[contents]

Contents

Syntax

The syntax for ifstream definitions is:

f++:  
ifstream definitions
ifstream(definitions)
:=(ifstream, definitions)
n++:  
@ifstream definitions
@ifstream(definitions)
@:=(ifstream, definitions)

Note: If you are using the first syntax for variable definitions and want to have more code and/or text following on the same line then simply end the definition with ';'.

Description

The ifstream type is used for input file streams.

Note: If you need to define thousands of variables then := is faster, plus it has useful error messages for unrecognised types.

Member functions

The following member functions are available for ifstream variables:

option description
close closes the file from reading
open(path) open a file to read from
option description

Options

The following options are available for ifstream definitions:

option description
const definition of a constant
layer="x" define variable at layer x
!mf do not add member functions for variables
private definition of a private
scope+="x" add x to scopes variable can be accessed from
option description

f++ example

Examples of ifstream being defined with f++:

int x
string str
ifstream ifs("input.txt")
read(ifs, x, str)
getline(ifs, str)
ifs.close()

n++ example

Examples of ifstream being defined with n++:

@int x
@string str
@ifstream ifs("input.txt")
@read(ifs, x, str)
@getline(ifs, str)
@ifs.close()