Preview

advantage and disadvantage of cell phones

Good Essays
Open Document
Open Document
787 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
advantage and disadvantage of cell phones
Tutorial
Example
Projects
C++ Graphics
C++ Forum
Contact Us
Tutorial contents
Introductions
C++ Basics
Program Structure
Variable: Data types
Constants
Operators
Basic Input/Output
Control Structures if....else statement while loop do...while loop for loop switch break, continue goto, exit statement
Function
Compound Structure
Array
Pointer
Data Structure
OOPs
Class
Inheritance
Polymorphism
Advanced
File Handling
C++ Graphics
Extra
C++ Examples
C++ Projects
DATA / FILE HANDLING IN C++

Before getting into this section, it is recommended that you have a proper understanding of Text file and Binary File. If any of both seems strange to you we give short information about these files:-
Text file. The text file stores the data in ASCII character. Each line of text is terminated with a special character known as EOL (End of Line) character or delimiter character in text files. When this EOL character is read or written, certain internal translations take place.
Binary file. The Binary File stores the data in the same format as it is held in memory. No delimiters are used for a line and no translations occur here in binary files.
The following stream classes can be used in C++ to working with files: ofstream: Write on files ifstream: Read from files fstream: Both read and write from/to files. OPENING FILE
To open a file we use open() command as following: ofstream cppfile; cppfile.open(“filename”,mode); In the above line: ofstream cppfile:
By using ofstream we declared a file variable cppfile who used to access file. cppfile.open (“filename”,mode): You can see that we use the file variablecppfile with open() to open a file. filename is a file which to be open and modecan be the following :
File mode
Uses
ios::app
Append to end of file ios::ate go to end of file on opening ios::binary file open in binary mode ios::in open file for reading only ios::out open file for writing only

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Nt2670 Unit 7 Lab 1

    • 402 Words
    • 2 Pages

    7. In case the file is opened another application in the future for modifying the file, such as adding more content either text, pictures, etc.…

    • 402 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    |File – Is a place where data is stored on a computer, there are many different types of files and most if not all data is stored in a file. |…

    • 829 Words
    • 4 Pages
    Satisfactory Essays
  • Better Essays

    Nt1310 Unit 1 Assignment

    • 1994 Words
    • 8 Pages

    For example, the capital letter A is ASCII character 65, the numeral 2 is ASCII 50, the character} is ASCII 125 and the metacharacter carriage return is ASCII 13. Systems based on ASCII use seven bits to represent these values digitally. In contrast, most computers store data in memory organized in eight-bit bytes. Files that contain machine-executable code and non-textual data typically contain all 256 possible eight-bit byte values. Many computer programs came to rely on this distinction between seven-bit text and eight-bit binary data, and would not function properly if non-ASCII characters appeared in data that was expected to include only ASCII text. For example, if the value of the eighth bit is not preserved, the program might interpret a byte value above 127 as a flag telling it to perform some function. It is often desirable, however, to be able to send non-textual data through text-based systems, such as when one might attach an image file to an e-mail message. To accomplish this, the data is encoded in some way, such that eight-bit data is encoded into seven-bit ASCII characters (generally using only alphanumeric and punctuation characters—the ASCII printable characters). Upon safe arrival at its destination, it is then…

    • 1994 Words
    • 8 Pages
    Better Essays
  • Good Essays

    Lesson 9

    • 673 Words
    • 3 Pages

    ___d____ 8. This describes a series of bytes with a fixed length that uniquely identifies a program or file.…

    • 673 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Anagram.Java

    • 448 Words
    • 2 Pages

    //Creates the arrayList called 'wordList' that is used to store the words from the file.…

    • 448 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    fasdf

    • 2790 Words
    • 12 Pages

    when completed, read files created by the popular notation software used by musicians to write…

    • 2790 Words
    • 12 Pages
    Powerful Essays
  • Satisfactory Essays

    Query language allows quick answers to ad hoc queries Provides better access to more and bettermanaged data…

    • 494 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    C++ Programming Language

    • 4580 Words
    • 19 Pages

    When one begins to write a program, the first action should be to define the variables that the program needs; variables are places in memory in which to store data items. Next, one writes the instructions to input values from the user (say, via the keyboard) and store those values in the…

    • 4580 Words
    • 19 Pages
    Powerful Essays
  • Better Essays

    inFile.next( ) – gets the next value in the file. Return data type is String. Essentially reads the file word by word.…

    • 928 Words
    • 10 Pages
    Better Essays
  • Good Essays

    java virtual machine

    • 731 Words
    • 3 Pages

    Java code is written in .java file. This code contains one or more Java language attributes like Classes, Methods, Variable, Objects etc. Javac is used to compile this code and to generate .class file. Class file is also known as “byte code“. The name byte code is given may be because of the structure of the instruction set of Java program. We will see more about the instruction set later in this tutorial. Java byte code is an input to Java Virtual Machine. JVM read this code and interpret it and executes the program.…

    • 731 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    C++ and Lt

    • 2169 Words
    • 9 Pages

    | This file declares services for user-controlled file processing. We will discuss about it in detail in File and Stream related chapter.…

    • 2169 Words
    • 9 Pages
    Powerful Essays
  • Better Essays

    Dbms

    • 1079 Words
    • 5 Pages

    The structures of the file are dependent on the application programming language. However file structure provided in one programming language such as direct file, indexed-sequential file which is available in COBOL programming, may be different from the structure generated by other programming language such as C. The direct incompatibility makes them difficult to process jointly.…

    • 1079 Words
    • 5 Pages
    Better Essays
  • Satisfactory Essays

    Sample program to input a textfile and input any text and save it in that text file…

    • 289 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    2. Free Nights and Weekends on some plans or free calling to other subscribers to that service or free calling to your favorite five people... you get the idea.…

    • 924 Words
    • 4 Pages
    Satisfactory Essays
  • Powerful Essays

    Kaxx

    • 3182 Words
    • 13 Pages

    A file is a collection of data stored in one unit, identified by a filename. It can be a document, picture, audio or video stream, data library, application, or other collection of data. The following is a brief description of each file type.…

    • 3182 Words
    • 13 Pages
    Powerful Essays