answersLogoWhite

0


Best Answer

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").

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is a statement used to open data file in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is file mode in c plus plus?

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+");


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


Which statement is not frequently used in C plus plus?

The goto statement.


Can anyone provide me with a C plus plus coding for hotel reservation system using data file handling?

That cannot be answered here; there are commercial packages to do this, which you can locate on the Internet.


The import statement is always the first noncomment statement in a Java program file?

False. If your class belongs to a package, the package statement should be the first statement. Plus, it's possible that you're not using any resources outside the default java.lang package, and would have no need to import any additional packages.

Related questions

How do you open a file in c plus plus?

fopen()


What is file mode in c plus plus?

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+");


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


Can you read a file after created by a program in C plus plus?

Yes. You can either create a file for both reading and writing, or you can re-open a file for reading after creating and writing to it.


Is 12 plus 2 equals 15 a open sentence?

No, it is a FALSE statement.


What is file structures in C plus plus?

As far as C++ is concerned files do not have structures, they are simply raw data streams. It's entirely down to the programmer to determine what structures exist within the file and to interpret the data accordingly. C++ cannot do it for you.


How do you create a simple student file in C Plus Plus?

Whenever you open a file using the function open of fstream class (header file) by using one of it's object you have created, the file is created automatically.You can do it this way:fstream filer;filer.open("Student.dat",ios::out);//This will create a file.This is just a code segment.


How do you include classes and structures in header files in c plus plus?

Classes and structures can be put in a header file the same way you would use them in a main program; the only difference is that they are placed in a separate file, called a header file. Then, after creating a new file, include that new file with the definition by the use of the preprocessor #include statement.


How can I open mms in my samsung s2 plus?

To open an MMS in a Samsung S2 Plus first check to see if the phone is set to automatically open files. If not either change the setting or click on the message to download the file.


Can you solve 6x plus 310?

NO- this is not an open statement . It has no truth set. It cannot be "solved" It is an algebraic expression or formula.


How do you Open a text file as C plus plus source code?

All C++ source code is is a text file with the .cpp extension. So if you save your code as *****.cpp then it is automatically C++ source code.


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