This is an unformatted output function and what is written is not necessarily a c-string, therefore any null-character found in the array s is copied to the destination and does not end the writing process.
Parameters
- s
- Pointer to a block data with the content to be written.
- n
- Integer value of type streamsize representing the size in characters of the block of data to write.
Return Value
The functions return *this.In case of error, the badbit flag is set (which can be checked with member bad). Also, depending on the values set through member exceptions, this may cause an exception of type ios_base::failure to be thrown.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
This example copies a file into memory and then writes its content to a new file.
Basic template member declaration
(basic_ostream<charT,traits>)| 1 2 |
|
See also
| ostream::put | Put character (public member function) |
| ostream::operator<< | Insert data with format (public member function) |
| istream::read | Read block of data (public member function) |
