【发布时间】:2018-01-21 05:22:07
【问题描述】:
Number of Spaces,10,,,,,,,,
,,,,,,,,,
,,,,,,,,,
Type,Set Id,Intraset Id,Name,Property Cost,House Cost,Hotel Cost,Rent,Rent with House,Rent With Hotel
Go,400,MU,,,,,,,
Property,0,0,Kemper A,500,50,50,5,50,2000
Property,0,1,Kemper B,1000,50,50,10,75,2500
Property,1,0,Bainer A,2000,200,200,20,100,3000
Property,1,1,Bainer B,2500,200,200,25,150,3000
Property,1,2,Bainer C,3000,200,200,30,200,3500
Property,2,0,SocialSci A,4000,400,400,40,300,4000
Property,2,1,SocialSci B,4500,400,400,45,400,4000
Property,2,2,SocialSci C,5000,400,400,50,500,4000
Property,2,3,SocialSci D,5500,400,400,55,600,4500
如何查找 CSV 文件的特定部分?我只需要0,0,Kemper A,500,50,50,5,50,2000 等每个属性的所有值。
我一直在做的是
fscanf(file,"Number of Spaces,%d",&b->numSpaces);
fscanf(file,"Go,%d",&b->goValue);
但这似乎效率低下/每个板都不同,并且没有固定数量的属性。有什么线索吗?
【问题讨论】: