logging in or signing up file handling by ankur sir test ppt study0070 Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 2122 Category: Education License: All Rights Reserved Like it (4) Dislike it (0) Added: September 29, 2008 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... By: kaja_kn (5 month(s) ago) sir, i need this presentation. please send it to my mail. kajamydeen.k@gmail.com Saving..... Post Reply Close Saving..... Edit Comment Close By: merry007 (28 month(s) ago) too good benefecial 4 me .allow 2 download it Saving..... Post Reply Close Saving..... Edit Comment Close By: kavita1234 (28 month(s) ago) download this presentation Saving..... Post Reply Close Saving..... Edit Comment Close By: study0070 (29 month(s) ago) give me your email id and tell for what purpose you want this file .? email me a t study0070@hotmail.com Saving..... Post Reply Close By: kavita1234 (28 month(s) ago) kavita_surjeet@rediffmail.com Saving..... Edit Comment Close By: annabi2003 (29 month(s) ago) Sir,please allow me to dow nload. Thanks Saving..... Post Reply Close By: study0070 (29 month(s) ago) may i know for what purpsoe u want b true.? Saving..... Edit Comment Close loading.... See all Premium member Presentation Transcript FILE HANDLING IN C++ : FILE HANDLING IN C++ C++ STREAMS : C++ STREAMS A Stream is a general name given to flow of data. Different streams are used to represent different kinds of data flow. Each stream is associated with a particular class, which contains member functions and definitions for dealing with that particular kind of data flow. Flow of Data…. : Flow of Data…. PROGRAM DEVICES OR FILES Input Stream >> Output Stream << Data Data istream class ostream class (Insertion operator) (Extraction operator) The following classes in C++ have access to file input and output functions: : The following classes in C++ have access to file input and output functions: ifstream ofstream fstream The Stream Class Hierarchy : The Stream Class Hierarchy ios istream get() getline() read() >> ostream put() write() << fstreambase iostream Ifstream Open() Tellg() Seekg() Ofstream Open() Tellp() Seekp() fstream NOTE : UPWARD ARROWS INDICATE THE BASE CLASS DIFFERENT FILE OPERATIONS : DIFFERENT FILE OPERATIONS OPENING A FILE CLOSING A FILE READING FROM A FILE WRITING ON A FILE CHECKING FOR END OF FILE Slide 7: A binary file stores data to disk in the same form in which it is represented in main memory. If you ever try to edit a binary file containing numbers you will see that the numbers appear as nonsense characters. Not having to translate numbers into a readable form makes binary files somewhat more efficient. Binary files also do not normally use anything to separate the data into lines. Such a file is just a stream of data with nothing in particular to separate components. Slide 8: When using a binary file we write whole record data to the file at once. When using a text file, we write out separately each of the pieces of data about a given record. The text file will be readable by an editor, but the numbers in the binary file will not be readable in this way. The programs to create the data files will differ in how they open the file and in how they write to the file. Slide 9: For the binary file we will use write to write to the file, whereas for the text file we will use the usual output operator(<<) and will output each of the pieces of the record separately. With the binary file we will use the read function to read a whole record, but with the text file we will read each of the pieces of record from the file separately, using the usual input operator(>>) EXAMPLES : EXAMPLES Creation of a text file :Sequential access. With this type of file access one must read the data in order, much like with a tape, whether the data is really stored on tape or not. Random access (or direct access). This type of file access lets you jump to any location in the file, then to any other, etc., all in a reasonable amount of time. : :Sequential access. With this type of file access one must read the data in order, much like with a tape, whether the data is really stored on tape or not. Random access (or direct access). This type of file access lets you jump to any location in the file, then to any other, etc., all in a reasonable amount of time. Types of File Access seekg() function : : seekg() function : With one argument : seekg(k) where k is absolute position from the beginning. The start of the file is byte 0 Begin File End k bytes ^ File pointer The seekg() function with one argument Slide 13: seekg() function : With two arguments : the first argument represents an offset from a particular location in the file. the second specifies the location from which the offset is measured. Begin End ^ Offset from Begin The seekg() function with two argument Slide 14: seekg() function : With two arguments : Begin End ^ Offset from Begin The seekg() function with two argument ^ ^ Offset from end Offset from current position You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
file handling by ankur sir test ppt study0070 Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 2122 Category: Education License: All Rights Reserved Like it (4) Dislike it (0) Added: September 29, 2008 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... By: kaja_kn (5 month(s) ago) sir, i need this presentation. please send it to my mail. kajamydeen.k@gmail.com Saving..... Post Reply Close Saving..... Edit Comment Close By: merry007 (28 month(s) ago) too good benefecial 4 me .allow 2 download it Saving..... Post Reply Close Saving..... Edit Comment Close By: kavita1234 (28 month(s) ago) download this presentation Saving..... Post Reply Close Saving..... Edit Comment Close By: study0070 (29 month(s) ago) give me your email id and tell for what purpose you want this file .? email me a t study0070@hotmail.com Saving..... Post Reply Close By: kavita1234 (28 month(s) ago) kavita_surjeet@rediffmail.com Saving..... Edit Comment Close By: annabi2003 (29 month(s) ago) Sir,please allow me to dow nload. Thanks Saving..... Post Reply Close By: study0070 (29 month(s) ago) may i know for what purpsoe u want b true.? Saving..... Edit Comment Close loading.... See all Premium member Presentation Transcript FILE HANDLING IN C++ : FILE HANDLING IN C++ C++ STREAMS : C++ STREAMS A Stream is a general name given to flow of data. Different streams are used to represent different kinds of data flow. Each stream is associated with a particular class, which contains member functions and definitions for dealing with that particular kind of data flow. Flow of Data…. : Flow of Data…. PROGRAM DEVICES OR FILES Input Stream >> Output Stream << Data Data istream class ostream class (Insertion operator) (Extraction operator) The following classes in C++ have access to file input and output functions: : The following classes in C++ have access to file input and output functions: ifstream ofstream fstream The Stream Class Hierarchy : The Stream Class Hierarchy ios istream get() getline() read() >> ostream put() write() << fstreambase iostream Ifstream Open() Tellg() Seekg() Ofstream Open() Tellp() Seekp() fstream NOTE : UPWARD ARROWS INDICATE THE BASE CLASS DIFFERENT FILE OPERATIONS : DIFFERENT FILE OPERATIONS OPENING A FILE CLOSING A FILE READING FROM A FILE WRITING ON A FILE CHECKING FOR END OF FILE Slide 7: A binary file stores data to disk in the same form in which it is represented in main memory. If you ever try to edit a binary file containing numbers you will see that the numbers appear as nonsense characters. Not having to translate numbers into a readable form makes binary files somewhat more efficient. Binary files also do not normally use anything to separate the data into lines. Such a file is just a stream of data with nothing in particular to separate components. Slide 8: When using a binary file we write whole record data to the file at once. When using a text file, we write out separately each of the pieces of data about a given record. The text file will be readable by an editor, but the numbers in the binary file will not be readable in this way. The programs to create the data files will differ in how they open the file and in how they write to the file. Slide 9: For the binary file we will use write to write to the file, whereas for the text file we will use the usual output operator(<<) and will output each of the pieces of the record separately. With the binary file we will use the read function to read a whole record, but with the text file we will read each of the pieces of record from the file separately, using the usual input operator(>>) EXAMPLES : EXAMPLES Creation of a text file :Sequential access. With this type of file access one must read the data in order, much like with a tape, whether the data is really stored on tape or not. Random access (or direct access). This type of file access lets you jump to any location in the file, then to any other, etc., all in a reasonable amount of time. : :Sequential access. With this type of file access one must read the data in order, much like with a tape, whether the data is really stored on tape or not. Random access (or direct access). This type of file access lets you jump to any location in the file, then to any other, etc., all in a reasonable amount of time. Types of File Access seekg() function : : seekg() function : With one argument : seekg(k) where k is absolute position from the beginning. The start of the file is byte 0 Begin File End k bytes ^ File pointer The seekg() function with one argument Slide 13: seekg() function : With two arguments : the first argument represents an offset from a particular location in the file. the second specifies the location from which the offset is measured. Begin End ^ Offset from Begin The seekg() function with two argument Slide 14: seekg() function : With two arguments : Begin End ^ Offset from Begin The seekg() function with two argument ^ ^ Offset from end Offset from current position