Enter your email address & Win:

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:

  1. File Structure ( FS ) Lab Program 2 ( 6th Semester Information Science)
  2. File Structure ( FS ) Lab Program 3 ( 6th Semester Information Science)
  3. File Structure ( FS ) Lab Program 4 ( 6th Semester Information Science)
  4. File Structure ( FS ) Lab Program 11 ( 6th Semester Information Science)
  5. File Structure ( FS ) Lab Program 12 ( 6th Semester Information Science)
  • Ya.. U have kept these uniquely
  • superhit1000
    how do we get this output
    USING file I/o
    1 for standard I/O
    2 for file I/O
    Enter your choice :2
    Enter data file name : name .txt
    enter reverse data file name : rev.txt
    [root@localhost] # catnames.txt
    KLS
    GOGTEtput
    Science
    ....
    how we get this out put as we know that fro local host we need to execute on fedora and its not possible to get output on Fedora. and we are using Turbo C++ complier which doesnt support this kind of output .
    what should we do?
    hope to hear from you soon.
  • superhit1000
    how do we get this output
    USING file I/o
    1 for standard I/O
    2 for file I/O
    Enter your choice :2
    Enter data file name : name .txt
    enter reverse data file name : rev.txt
    [root@localhost] # catnames.txt
    KLS
    GOGTEtput
    Science
    ....
    how we get this out put as we know that fro local host we need to execute on fedora and its not possible to get output on Fedora. and we are using Turbo C++ complier which doesnt support this kind of output .
    what should we do?
    hope to hear from you soon.
  • superhit1000
    how do we excute the second part in fs lab first program .. please tell in detail if any one has executed
  • What did you mean by "Second part in first program" ?
  • superhit1000
    how do we excute the second part in fs lab first program .. please tell in detail if any one has executed
  • What did you mean by "Second part in first program" ?
blog comments powered by Disqus
Get Adobe Flash playerPlugin by wpburn.com wordpress themes