将数据从excel提取到c。 [英] Extracting data from excel to c.
本文介绍了将数据从excel提取到c。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我打算从excel中提取数据到我的程序中。我想要的是来自excel的数据应该作为一个数组存储在我的程序中。
我写了下面的代码但它不起作用。
I intend to extract data from excel into my program. What i want is the data from excel should be stored as an array in my program.
I have written the following code but it does not work.
f1=fopen("Cost.xls" , "r");
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
fscanf(f1,"%d",&c[i][j]);
}
fprintf(f1, "\n");
}
fclose(f1);
推荐答案
此论坛已在本论坛中提出并完整回答。
阅读和写作用C ++中的Excel文件 [ ^ ]
如果你可以使用csv文件,这是最简单的方法。
This question has been asked and answered fully in this forum.
Reading from and writing to Excel files in C++[^]
If you can work with csv files this is the easiest approach.
这篇关于将数据从excel提取到c。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文