explaining of codes 2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
and this function too 

void writeFile()
{
    ofstream fout("tmp.txt");//opening file"bs.txt" for writing
    temp=head;
    while(temp!=NULL)//while data in list
    {
        fout.fill('0');
        fout.width(3);
        fout<<std::right<<temp->b.getID()<<':';
        fout<<"Room ";
        fout<<std::left<<temp->b.getRoomNo()<<':';
        fout<<"Level ";
        fout<<temp->b.getLevelNo()<<':';
        fout<<temp->b.getDate()<<':';
        fout.width(4);
        fout<<std::right<<temp->b.getTime()<<':';
        fout<<std::left<<temp->b.getDuration()<<':';
        fout<<temp->b.getSubject()<<':';
        fout<<temp->b.getLecturer()<<endl;
        temp=temp->next;
    }
    fout.close();
    ifstream read("tmp.txt");
    fout.open("bs.txt");
    fout<<encrypt<<endl;
    char c;
    read.get(c);
    while(read)
    {
        if(c!=10)
            c+=encrypt*10;
        fout.put(c);
        read.get(c);
    }    
    read.close();
    fout.close();
    remove("tmp.txt");
}
Last edited on
Topic archived. No new replies allowed.