#include<stdio.h>
#include<string.h>
void main()
{
    FILE *stream;
    stream = fopen("EMA.txt", "r");
    if(!stream)
    {
        printf("open file error");
        return 0;
    }
    char num[4000][100];
    char SysStockCode[4000][9];
    char StockCode[4000][6];
    char BourseNo[4000][2];
    char values[4000][15];
    char tempTotal[50] = "\0";
    int i=0;
    char seps[] = ",";
    char star[] = ".";
    while(fgets(tempTotal,100,stream))
    {
        int count =0;
        char *token;
        tempTotal[strlen(tempTotal)-1]='\0';//ɾ³ý×îºóµÄ»Ø³µ×Ö·û
        strcpy(num[i],tempTotal);
        token = strtok( tempTotal, seps );

        while( token != NULL )
        {
            if(count%3==0)strcpy(SysStockCode[i], token);
            else if(count%3==2)strcpy(values[i], token);
            token = strtok( NULL, seps );
            count++;
        }
       
        char *wordToken;
        char tempCode[9]= "\0";
        strcpy(tempCode,SysStockCode[i]);
        wordToken = strtok( tempCode, star );
        strcpy(StockCode[i],wordToken);
        wordToken = strtok( NULL, star);
        strcpy(BourseNo[i],wordToken);
        delete  wordToken;
        //printf("All:%s,SysStockCode:%s,StockCode:%s,BourseNo:%s,values:%s\n",num[i],SysStockCode[i],StockCode[i],BourseNo[i],values[i]);
        i++;
    }
    printf("%d",i);
    fclose(stream);
}