File Structure ( FS ) Lab Program 2 ( 6th Semester Information Science)
// March 25th, 2009 // Educational, Engineering, File Structure (F.S.) Lab // Written by sandeephegde
-->FILE STRUCTURES LAB
Semester : 6
Subject Code : O6ISL67
Experiment No. : 2
Objective of the Experiment : To make objects persistet by writing them to file . To maintain identity of fields and records , add delimiters to fields and make records of fixed length.
Build two separate classes Student and FixedLengthBuffer (Record size =75). Write overloaded insertion and extraction operators for reading and displaying student data . Implement Pack() , UnPack() ,Read(), Write () methods for performing Buffer and file opeartions.Use ‘ | ‘ as field Delimiter.
Class should have constructor to initialize buffer and student objects.
Procedure in main :
1. Create Student object and initialize
2. Create buffer object and initialize
3. Open file in write mode
4. Read data for student
5. Pack the student object into buffer
6. Write the buffer to file
7. Repeat step 4-6 for 15 students
8. Close the file.
9. Open the file in read mode
10. Read a record into buffer
11. Unpack the fields and restore the state of an Object
12. Display student record
13. Repeat steps 10-12 for all the records stored in the file
14. Close the file.
Buffer Contents Record USN Name Address Semester
11 | student1 |Belgaum |1……………. 1 11 student1 Belgaum 1
12 |student2 |bangalore |2…………… 2 12 student2 bangalore 2
If you enjoyed this post, make sure you subscribe to my RSS feed!
Related posts:
- File Structure ( FS ) Lab Program 2 ( 6th Semester Information Science)
- File Structure ( FS ) Lab Program 3 ( 6th Semester Information Science)
- File Structure ( FS ) Lab Program 4 ( 6th Semester Information Science)
- File Structure ( FS ) Lab Program 11 ( 6th Semester Information Science)
- File Structure ( FS ) Lab Program 12 ( 6th Semester Information Science)
-
RAVi
-
superhit1000
-
superhit1000
-
superhit1000
-
sandeephegde
-
superhit1000
-
sandeephegde



