Time.h date does not work in ifstream

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
void OrderList::setDate(char* date){
    this->date = date;
}

char* OrderList::getDate(){
    return date;
}

void readOrder( OrderList *&order , int &orderIndex , int &itemIndex ){
    ifstream inFile;
    string name = "";
    string item = "";
    string status = "";
    string model = "";
    char date[9];
    int quan = 0;
    double price = 0.00;
    double warranty = 0.00;

    inFile.open("order.txt");
    if( inFile.fail() )
            cout << "Unable to open file " << endl;
    inFile >> orderIndex;  
    order = new OrderList[orderIndex+1];
    inFile.ignore();
    for( int i = 0 ; i < orderIndex ; i++){
		
        getline( inFile , name );
        order[i].setCompanyName(name);
        
        inFile >> itemIndex;
        inFile.ignore();
        for( int k = 0 ; k < itemIndex ; k++ ){
        
            getline( inFile , item );
            order[i].orderItem[k].itemName = item;
            getline( inFile , model );
            order[i].orderItem[k].modelName = model;

            inFile >> quan;
            order[i].orderItem[k].quantity = quan;
            inFile >> price;
            order[i].orderItem[k].price = price;
            inFile >> warranty;
            order[i].orderItem[k].warranty = warranty;
            inFile.ignore();
        }
        inFile.ignore();
        inFile.getline(date,9);
        order[i].setDate(date);
        getline( inFile , status );
        order[i].setOrderStatus( status );
		
    }
}

void saveOrder(  OrderList *&order , ofstream &outFile , int &orderIndex ,int &itemIndex){
    outFile.open( "order.txt" );
    outFile << orderIndex << endl;
    for( int i = 0 ; i < orderIndex ; i++ ){
        outFile << order[i].getCompanyName() << endl
                << itemIndex << endl;
        for( int k = 0 ; k < itemIndex ; k++ ){
            outFile << order[i].orderItem[k].itemName    << endl
                    << order[i].orderItem[k].modelName   << endl
                    << order[i].orderItem[k].quantity    << endl
                    << order[i].orderItem[k].price       << endl
                    << order[i].orderItem[k].warranty    << endl;
        }
        outFile << order[i].getDate()        << endl;
        outFile << order[i].getOrderStatus() << endl;
    }
}


txt output correct in file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1
KEZN
2
HITACHI
HTC2011-500TB
2
1000
4
SAMSUNG
ST-56/2-PLASMA
3
13500
6
04/05/13
PENDING


but why when i display the time. it get the output something like
1
2
os?
o4as/2
Topic archived. No new replies allowed.