logging in or signing up data file handling in C++ gulsdps 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: 4064 Category: Education License: All Rights Reserved Like it (9) Dislike it (0) Added: June 03, 2009 This Presentation is Public Favorites: 3 Presentation Description learn basic with data file handling Comments Posting comment... By: junglemeinlion (10 month(s) ago) respected sir/mam i need this persentation for my project Saving..... Post Reply Close Saving..... Edit Comment Close By: WALI88119 (13 month(s) ago) I need the ppt in file and stream in c Saving..... Post Reply Close Saving..... Edit Comment Close By: nidummer (17 month(s) ago) thanks Saving..... Post Reply Close Saving..... Edit Comment Close By: bishnunayak (17 month(s) ago) hey please allow to download this ppt !!!!!!!!! Saving..... Post Reply Close By: pre251651 (17 month(s) ago) hey how can this presen,. will down load Saving..... Edit Comment Close By: mynamelingaraj (19 month(s) ago) hi i need this ppt Saving..... Post Reply Close Saving..... Edit Comment Close loading.... See all Premium member Presentation Transcript File Handling in C++ : File Handling in C++ Presentation Slides Created By Gulshan Kumar Hans PGT Computer Science K.V. No.3, Jaipur File Handling : File Handling Introduction to File Handling Data entered once, required later again Same Data to be used by others Data required again by the same program Files and Streams Slide 3: Program Files Input Stream Output Stream I/O Streams : I/O Streams Stream Description cin Standard input stream cout Standard output stream cerr Standard error stream File i/o Streams : File i/o Streams Stream Classes required for File i/o : ifstream ofstream fstream ifstream : ifstream Input file stream Class open() is a member function of the class ifstream Inherited functions of ifstream class, from the class istream are get() getline() read() seekg() tellg() ofstream : ofstream Output file stream Class open() is a member function of the class ofstream Inherited functions of ofstream class, from the class ostream are put() write() seekp() tellp() fstream : fstream It supports files for simultaneous input and output fstream is derived from ifstream ofstream iostream They are parent classes and fstream is the child class fstream : fstream Member functions of the class fstream open close close all seekg seekp tellg tellp Function in C++ : Function in C++ Function:- A function groups a number of program statements into a unit and gives it a name. The function are used to increase the modularity of the programs and packages. After defining a function, we can call defined function inside the main() Process for using a function: Function Prototype (declaring a function) Function Definition (defining a function with operation statements) Function Call ( calling a function inside the main) Slide 11: #include<iostream.h> void line(); //function prototype void main() ( cout << “ the value of function is”; line(); // calling of function } void line() // function definition { cout<< “welcome”; } Slide 12: Data file handling program – (Input and Output with Multiple objects) #include<fstream.h> class person { public: char name[30]; int tel; void getdata(void) { cout<<“ Enter name:”; cin>>name; cout<<“ Enter telephone number:”; cin>>tel; } void showdata(void) { cout<< “name is”<< name; cout<<“ tel number is”<< tel; } }; Slide 13: Void main() { person p; char ch; fstream file; file.open(“test. Txt”, ios::app, ios::in, ios::out); do { cout<<“ Enter your data”; p.getdata(); file.write ( ( char *) &p , size of (p)); cout <<wants to enter another record (y/n)”; cin>>ch; } while(ch==‘y’ || ch==‘Y’); file.seekg(0); // reset to start file file.read( ( char*)&p, size of (p)); Slide 14: while (!file.eof()) { cout<<“ person is : ”; p.showdata(); // p is a class object and show data is a function file.read( (char *) &p, size of (p)); } } Slide 15: Take print out of text file and binary file We have speical file name for hardware devices: ofstream outfile; outfile.open(‘ ‘PRN’ ’); // OPEN FOR PRINTER Output.put(variable name); Slide 16: THANKS You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
data file handling in C++ gulsdps 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: 4064 Category: Education License: All Rights Reserved Like it (9) Dislike it (0) Added: June 03, 2009 This Presentation is Public Favorites: 3 Presentation Description learn basic with data file handling Comments Posting comment... By: junglemeinlion (10 month(s) ago) respected sir/mam i need this persentation for my project Saving..... Post Reply Close Saving..... Edit Comment Close By: WALI88119 (13 month(s) ago) I need the ppt in file and stream in c Saving..... Post Reply Close Saving..... Edit Comment Close By: nidummer (17 month(s) ago) thanks Saving..... Post Reply Close Saving..... Edit Comment Close By: bishnunayak (17 month(s) ago) hey please allow to download this ppt !!!!!!!!! Saving..... Post Reply Close By: pre251651 (17 month(s) ago) hey how can this presen,. will down load Saving..... Edit Comment Close By: mynamelingaraj (19 month(s) ago) hi i need this ppt Saving..... Post Reply Close Saving..... Edit Comment Close loading.... See all Premium member Presentation Transcript File Handling in C++ : File Handling in C++ Presentation Slides Created By Gulshan Kumar Hans PGT Computer Science K.V. No.3, Jaipur File Handling : File Handling Introduction to File Handling Data entered once, required later again Same Data to be used by others Data required again by the same program Files and Streams Slide 3: Program Files Input Stream Output Stream I/O Streams : I/O Streams Stream Description cin Standard input stream cout Standard output stream cerr Standard error stream File i/o Streams : File i/o Streams Stream Classes required for File i/o : ifstream ofstream fstream ifstream : ifstream Input file stream Class open() is a member function of the class ifstream Inherited functions of ifstream class, from the class istream are get() getline() read() seekg() tellg() ofstream : ofstream Output file stream Class open() is a member function of the class ofstream Inherited functions of ofstream class, from the class ostream are put() write() seekp() tellp() fstream : fstream It supports files for simultaneous input and output fstream is derived from ifstream ofstream iostream They are parent classes and fstream is the child class fstream : fstream Member functions of the class fstream open close close all seekg seekp tellg tellp Function in C++ : Function in C++ Function:- A function groups a number of program statements into a unit and gives it a name. The function are used to increase the modularity of the programs and packages. After defining a function, we can call defined function inside the main() Process for using a function: Function Prototype (declaring a function) Function Definition (defining a function with operation statements) Function Call ( calling a function inside the main) Slide 11: #include<iostream.h> void line(); //function prototype void main() ( cout << “ the value of function is”; line(); // calling of function } void line() // function definition { cout<< “welcome”; } Slide 12: Data file handling program – (Input and Output with Multiple objects) #include<fstream.h> class person { public: char name[30]; int tel; void getdata(void) { cout<<“ Enter name:”; cin>>name; cout<<“ Enter telephone number:”; cin>>tel; } void showdata(void) { cout<< “name is”<< name; cout<<“ tel number is”<< tel; } }; Slide 13: Void main() { person p; char ch; fstream file; file.open(“test. Txt”, ios::app, ios::in, ios::out); do { cout<<“ Enter your data”; p.getdata(); file.write ( ( char *) &p , size of (p)); cout <<wants to enter another record (y/n)”; cin>>ch; } while(ch==‘y’ || ch==‘Y’); file.seekg(0); // reset to start file file.read( ( char*)&p, size of (p)); Slide 14: while (!file.eof()) { cout<<“ person is : ”; p.showdata(); // p is a class object and show data is a function file.read( (char *) &p, size of (p)); } } Slide 15: Take print out of text file and binary file We have speical file name for hardware devices: ofstream outfile; outfile.open(‘ ‘PRN’ ’); // OPEN FOR PRINTER Output.put(variable name); Slide 16: THANKS