![]() |
Data From C++ GUI to Excel/Notepad, Application Trouble
"Hi,
I need to get data from a C++ application to a spread sheet or notepad file, has anyone any idea how to do this. I have access to programme source code but not sure where to start." |
Re: Data From C++ GUI to Excel/Notepad, Application Trouble
Quote:
|
Re: Data From C++ GUI to Excel/Notepad, Application Trouble
Quote:
To output to a file from a C++ program, you have a few choices. 1) The program can output all of the data you need to a command line, and then when you run the program run it as: your_program.exe > file_with_data.txt The ">" tells the command line to take all of the text that was outputted to stdout (which is what cout and printf do) and put it into the file following the ">" sign, in this case "file_with_data.txt" 2) There is a standard library for outputting to files for C++ from within the program. It's called 'fstream', so you would put "#include <fstream>" at the beginning of your program. To use this, you would need to make an fstream object at the beginning of your program, and then use it like "cout" to output data. Here's an example: Code:
fstream file_output; // create an 'fstream' objectHope that was clear, good luck :p |
Re: Data From C++ GUI to Excel/Notepad, Application Trouble
If you want to output to a spreadsheet, look into CSV. Excel and most other spreadsheet tools can read it automatically.
It's basically just like writing to a text file, but inserting commas and carriage returns to denote rows/columns. |
| All times are GMT -5. The time now is 03:16. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi