读取文件 ,发现文件里的数据多了
文本文件:1234;78;90;668;778;读取后,把数据放到一个数组中int main(){FILE* file;file=fopen("test.txt","r");if(!file){ cerr<<"error"<<endl; return -1;}int arr[2000];int count=0;while(!feof(file) ){ char strOneLine[256]; fscanf(file, "%s",strOneLine); //读入之后 //分解到int arr中 char* p=strtok(strOneLine,";"); while(p) { arr[count++]=atoi(p); cout<<p<<endl; p=strtok(NULL,";"); }} cout<<"有:"<<count<<"个元素"<<endl;fclose(file);return 0;}代码运行后,发现有6个元素,是怎么回事啊???不是5个,