| |

VerySource

 Forgot password?
 Register
Search
View: 671|Reply: 3

How can I save the data into a file and save it on the hard disk?

[Copy link]

1

Threads

27

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-2-15 12:00:01
| Show all posts |Read mode
I got an array Error containing 20 data in the xxDoc class. I want to save the data to a specified folder in the format of a text file. How can I write the code? What about saving as an Excle file?
Reply

Use magic Report

2

Threads

19

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-4-19 19:00:01
| Show all posts
#include <fstream.h>

writedata.open ("[file name]", ios :: out);
if (! writedata)
    MessageBox ("Error while saving file", "Error", MB_OK);
else
{
   writedata << variable 1 << variable 1 .... << variable 20;
   writedata << "\n";
   writedata.close ();
}
CFile class is also available
Reply

Use magic Report

1

Threads

27

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

 Author| Post time: 2020-4-20 16:15:01
| Show all posts
Weakly ask what kind of instance is writedata?
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-5-14 13:15:01
| Show all posts
Use the CFile class, just write a log file
Very simple
You want me to give you a class
The ones written in the Excle file can be found on the Internet, and those that have been found before, please go and see for yourself
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list