C++ Writing to file

tutorial and example
tutorial and example

C++ File Handling write() Function

In file handling, write() function is used to write data into the file. The write() uses ofstream or fstreamlibrary to write into file.

Syntax

The write() takes two arguments. The first argument is address of variable var and second argument is size of variable var in bytes.

Example

C++ File Handling write() Function Example

Output: