chapter 12 C ++ TUTORIAL “CREATING FILE AND INPUT DATA IN A FILE”

FILE HANDLING:- file handling is an un manage resources of our application.

OPENING AND CLOSING OF A FILE : – The file name is a string of characters that make up a valid file name.for example the OPERATING SYSTEM it may contain two parts A primary name and an optical extension part. EXAMPLE void main( ){clrscr( ); ofstream file(“filename.dat”)         \\creating a file you can use any extention after file nameor ofstream file(“d:\filename.dat”)            \\creating a file you can use any extention after file nameint eid,sal;                                                    \\variable declaration char name[20]; cout<<"enter emp id :";cin>>eid;                                                 \\ input emp idcout<<"enter name:";gets(name);                                                \\input namecout<<"enter salary : ";cin>>Sal;                                                     \\input salaryfile& lt;& lt;& lt;file.close();                                    \\closing the file getch();}

Leave an Awesome Comment

comments

About Admin

Nishant Srivastava is a blogger & Software Developer from New Delhi, India. He writes
about Programming Technologies,Gadget Reviews,Website Reviews,Tips and Tricks about Computers,SEO, Technology and Make money online on this Blog.

GeeksTrack.com Runs on Hostgator Hosting!

Geeks Track Strongly Recommends to use Hostgator if you are Planning to start Online Business,The Hostgator Hosting Helps you to build incredible websites with WordPress. Hostgator provides 24x7 Support and Number one hosting provider for hosting Blogs and Websites.

Speak Your Mind

*