fn: stream.close
[contents]

Contents

Syntax

The syntax for stream.close calls is:

f++:  
name.close()
stream.close(names)

n++:  
@name.close()
@stream.close(names)

Description

The stream.close function takes a non-zero number of parameters specifying the names of variables to close of type ifstream, fstream and ofstream. As a member function it takes zero functions and closes the stream.

Note: For large scale projects you will find specifying the !mf option to not add member functions during definitions and using stream.close is faster than using the close member function.

f++ example

Example of stream.close being used with f++:

ofstream ofs("output.txt")
write(ofs, "hello, world!")
ofs.close

n++ example

Example of stream.close being used with n++:

@ofstream ofs("output.txt")
@write(ofs, "hello, world!")
@ofs.close

Sponsors