iostream - what is the difference between binary and txt modes in C++ -


this question has answer here:

i began use c++ recently,and may seem nieve queation couldn't find answer it. when creating fstream object, have 2 options mode, binary , txt. fstream f ("file.txt",ios::out|ios::binary); , fstream f ("file.txt,ios::out|ios::binary); both write same strings when use overloaded operator << . question differwnce between 2 modes , affect number of bytes used write characters stream, need diifferent seekg when read data written each fstream ?

certain special characters may changed depending on mode using. also, special characters changed may depend on os or computer system code runs on.

with binary files sure file read as-is, on computer , regardless of contents of file. difference in kind of file io says all: text mode text based files, binary other kinds of io (even text files if don't want interpretation take place!)


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -