my input file:
QT, Quan Tri, 4
KT, Kinh Te, 4
DT, Dien Tu, 5
MT, My Thuat, 4.5
NN, Ngoai Ngu, 4
my method:
void ReadFileDT(fstream &file)
{
    char c;
    CarneerDT dt;
    int i=0;
    int t=0;// position attributes
    int k=0;
    char number[10];
    while(!file.eof())
    {           
        c=file.get(); //get a letter in the file
        //end of line processing
        if(c=='\n')
        {
            break;          
        }
        if(c!=',')
        {
            switch(t)
            {
            case 0: dt.id[i++]=c;break;
            case 1: number[k++]=c;break;
            case 2: number[k]=c;number[k+1]='\0';dt.year=atof(number);t++;break;            
            }
        }
        else
        {
            switch(t)
            {
            case 0:dt.id[i]='\0';break;
            case 1:number[k]='\0';strcpy(dt.name,number); k=0;break;        
            }           
            t++;        
        }           
    }
    cout<<endl;
    XuatDT(dt);
}
void ReadAllDT(char *tenfile)
{
    char c;
    fstream file;
    file.open("NganhDT.txt",ios::in);
    if(file.fail())
    {
        cout<<"File Error!";
        exit(1);
    }
    while(!file.eof())
    {
        ReadFileDT(file);       
    }
    file.close();
}
it show "Run-Time Check Failure #2 - Stack around the variable 'number' was corrupted." and year always equal to 0.00000000000. Was I wrong in line:"case 2: number[k]=c;number[k+1]='\0';dt.year=atof(number);t++;break;"?
 
    