#include <iostream>
#include <fstream>
#include <string>
using namespace std;
ifstream in("temp");
void readData(int &count ,int &line);
void readData(int &count ,int &line)
{
string r;
getline(in , r , '\n' );
sscanf((char*)r.c_str() ,"%d",&line );
getline(in , r , '\n' );
sscanf((char*)r.c_str() ,"%d",&count );
}
//ifstream in("temp");
int main()
{
string r;
int x;
int count = 0;
int line = 0;
readData(count ,line);
while( getline(in , r , '\n' ) )
{
sscanf((char*)r.c_str() ,"%d",&x);
cout<<x<<endl;
if(1 == count--)
{
cout<<"-------------------"<<endl;
readData(count ,line);
}
}
in.close();
return 0;
}
能够实现楼主所要的功能!
[[it] 本帖最后由 studentm 于 2008-12-16 09:20 编辑 [/it]]