如何从.txt文件中提取出一个一个的阿拉伯数据?
csdn.txt中的内容结构如下:
graph 1 11.081 4.8889
node 0 4.9153 4.1133 0.5 0.19444 "1000 Years for Revenge" filled ellipse #00ff00 lightgrey
node 1 4.0532 4.4635 0.5 0.19444 "Bush vs. the Beltway" filled ellipse #0000ff lightgrey
node 2 5.5702 4.1724 0.5 0.19444 "Charlie Wilson's War" filled ellipse #0000ff lightgrey
node 3 3.5785 3.1964 0.5 0.19444 "Losing Bin Laden" filled ellipse #0000ff lightgrey
node 4 5.3341 3.4986 0.5 0.19444 "Sleeping With the Devil" filled ellipse #00ff00 lightgrey
使用 infile>>a[i];
很方便,可以一下读出456这样的数据到a[i]里面。但是一下子要把文件中所有的数据都读出来。
如何控制这个文件流,使之从每一行的数据项开始读,比如
node 0 4.9153 4.1133 0.5 0.19444 "1000 Years for Revenge" filled ellipse #00ff00 lightgrey
从node后面的数字0开始读取,然后读4.9153 4.1133 ,然后读下一行
谢谢