|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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." |
|
#2
|
||||
|
||||
|
Re: Data From C++ GUI to Excel/Notepad, Application Trouble
Quote:
|
|
#3
|
||||
|
||||
|
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' object
file_output.open("my_filename.txt"); // open the file 'my_filename.txt'
//whenever you want to output data:
file_output << "This goes into the file";
//and at the end to close the file:
file_output.close();
Hope that was clear, good luck ![]() |
|
#4
|
|||||
|
|||||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| live input/output to/from application | MarkH | Programming | 3 | 06-04-2006 01:43 |
| Getting data from the robot | mfwit | LabView and Data Acquisition | 1 | 19-02-2006 20:07 |
| How do I declare a string and pass it from a Visual Basic GUI to a C++ DLL? | complete | Programming | 0 | 14-01-2006 17:35 |
| Color Picker gone from GUI. | Firestorm | Programming | 2 | 14-02-2005 21:54 |
| Program to copy list of files from Windows explorer as text into an application? | Elgin Clock | IT / Communications | 6 | 30-12-2004 21:23 |