Download presentation
Presentation is loading. Please wait.
Published byMabel Sarah Higgins Modified over 9 years ago
1
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
2
What is a file? A piece of memory in secondary storage or disk. Will retain after reboot of computer or restart of the program. Memory or RAM wont retain after program restart or reboot of computer. Secondary memory is slower than RAM. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
3
Example A jpg file which is a picture. An html page which is a file in a web server. A download program is a nothing but a group of files, say skype or gtalk or anything like that. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
4
How to create and access file in C program? As for most of the other thing some library function. fopen – to open or create a file fread – read from the file to program memory ( variable ) fwrite – write to file from the contents of memory SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
5
Steps for reading 1. Make a file using notepad. 2. Open that file 3. Read from the file 4. Print the contents of the file. 5. Close the file SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
6
Steps for writing Open an empty file Initialize a character array. Print the contents of the array ( which is memory ) to the file. Close the file Check the file using notepad if the program worked. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
7
Demo Reading and writing to a file. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
8
Student details program using files. A program to do the following Accept the number of students. Accept the details of above mentioned students. Details name, id address for each student. Save the entered details to a file. Another program to Read the file and display content. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
9
Demo Student details program using files. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
10
Thank you SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.