Computer Science, asked by thakurajayzb1754, 1 year ago

Discuss file opening modes in detail.


Anonymous: to
Anonymous: dp
Anonymous: me
Anonymous: sorry
Anonymous: nhi
Anonymous: ku
Anonymous: ch
Anonymous: r u angry

Answers

Answered by nishitadeka82
6

HOLA BUDDY...

here is your answer--------»»»

Different modes of opening a file

A file can be opened in different modes. Given below are some of the most commonly used modes for opening or creating a file.

# r : opens a text file in reading mode.

# w : opens or create a text file in writing mode.

# a : opens a text file in append mode.

# r+ : opens a text file in both reading and writing mode. The file must exist.

# w+ : opens a text file in both reading and writing mode. If the file exists, it is truncated first before overwriting. Any old data will be lost. If the file does not exist, a new file will be created.

# a+ : opens a text file in both reading and appending mode. New data is appended at the end of the file and does not overwrite the existing content.

# rb : opens a binary file in reading mode.

# wb : opens or create a binary file in writing mode.

ab : opens a binary file in append mode.

# rb+ : opens a binary file in both reading and writing mode, the original content is overwritten if the file exists.

# wb+: opens a binary file in both reading and writing mode and works similar to the w+ mode for binary files. The file content is deleted first and then new content is added.

# ab+: opens a binary file in both reading and appending mode and appends data at the end of the file without overwriting the existing content.

#hope it helps you....

plzz mark it as brainliest.....^·^


Anonymous: hlw
Similar questions