Tuesday, July 28, 2009

Exporting c++ output into excel?

I was wondering if someone could explain how I can go about transferring output from c++ program code into excel and vice versa. All the information I have found on the internet relates to Microsoft Visual Basic and it does not make much sense as I am using a Dev C++ compiler.





Any help will be greatly appreciated!!!

Exporting c++ output into excel?
You could use a .csv file - which is comma seperated values.





Each cell is seperated with a comma, and each row is ended with a CR ( endl).


Here is a simple example





#include %26lt;iostream%26gt;


#include %26lt;fstream%26gt;








using namespace std;








int main(int args, char * argv[])


{


ofstream MyExcelFile;


MyExcelFile.open("C:\\example.csv");





MyExcelFile %26lt;%26lt; "First Name, Last Name, Middle Initial" %26lt;%26lt; endl;


MyExcelFile %26lt;%26lt; "Jack, Nimble, B." %26lt;%26lt; endl;


MyExcelFile.close();


return 0;


}





You can look up more information of Csv format at


http://www.creativyst.com/Doc/Articles/C...


No comments:

Post a Comment