Skip to Content
Beginning C++
book

Beginning C++

by Ivor Horton
November 2014
Beginner content levelBeginner
632 pages
19h 31m
English
Apress
Content preview from Beginning C++

Stream Operations in Binary Mode

There are many situations in which text mode isn’t appropriate or convenient, and it can sometimes cause difficulties. The transformation of newline characters into two characters on some systems and not others makes relative seek operations unreliable for programs that are to run in both environments. By using binary mode, you avoid these complications and make the stream operations much simpler. You’ve already seen how to open a stream in binary mode: you just need to specify the open mode flags appropriately. You can read and write a file in binary mode using functions that you have already seen, put() and get(). Let’s try it in an example.

We can write a program that will copy any file. The copying can be ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning C++

Beginning C++

Brian Foster
Advanced C++

Advanced C++

Gazihan Alankus, Olena Lizina, Rakesh Mane, Vivek Nagarajan, Brian Price
Expert C++

Expert C++

Vardan Grigoryan, Shunguang Wu

Publisher Resources

ISBN: 9781484200070Purchase book