answersLogoWhite

0

There are 6 main types of file opening mode:

* "r". Open file for reading and file must exist; * "w" Open file for writing. If file does not exist it is created or if life already exist it's content is erased. * "a" Open file for appending. It adds all information at the end of the file leaving old data untouched. If file does not exist it is created. * "r+" Open file for reading and writing and file must exist. * "w+" Open file for writing and reading. If file does not exist it is created or if life already exist it's content is erased. * "a+" Open file for appending and reading. Again all new data is written at the end of the file old data leaving untouched. If file does not exist it is created. (You can read old data by moving pointer in file using fseek or rewind functions from stdio.h. But all writing operations will be done at the end of the file no matter how you change pointer) It is assumed by default that file will be standard ASCII text file in order to open file as binary file, you need to add "b" indicator:

FILE *myFile = fopen("myfile.txt", "wb");

/ * following two has identical meaning */

FILE *myFile = fopen("myfile.txt", "w+b");

FILE *myFile = fopen("myfile.txt", "wb+");

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

What is a statement used to open data file in c plus plus?

FILE* fopen(<filename>, <mode>); E.g., FILE* f = fopen("C:\\Users\\<user_name>\\My Documents\\data_file.dat", "rb"); Opens the specified file for reading ("r") in binary mode ("b").


How do you use fopen in c plus plus?

#include <stdio.h> ... FILE *f = fopen ("name", "mode");


What is step involve is using data file in c plus plus programming?

Declaration of file pointer opening of file in desired mode. performing the desired operation. closing the file


How to use graphics in c plus plus?

At the beginning in the header file: #include <graphics.h>


Example for w plus mode in c?

1. open the file: fopen (name, "w+") 2. write into it 3. rewind 4. read from the file


How do you create .exe file in c plus plus?

You can create an exe-file from your C++ source, if you have a compiler.


How file will be opened in different mode in c?

Different_modes_of_using_file_in_C


How do you open a file in c plus plus?

fopen()


How you can delete the data in the file when you open the file in read or write mode in C programming?

When you open a file in write mode, eg. fp=fopen("filename.txt","w"); the content of the file is deleted.


Is there a file concept in c plus plus?

No. The standard does not define nor require a file concept.


Can you rewrite a cuda file in c c plus plus language?

Yes, you can rewrite a cuda program originally written in c in c plus plus.


What is a scatter file in c or c plus plus programming?

Scatter File is a linker script file used by RVCT/Keil for ARM processors. It is used by arm linker.