| |

VerySource

 Forgot password?
 Register
Search
View: 829|Reply: 6

How do I write an object to the hard disk?

[Copy link]

1

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-5 15:40:02
| Show all posts |Read mode
When writing a small database, I hope you can answer it!
Reply

Use magic Report

0

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-5 19:09:02
| Show all posts
fwrite
Reply

Use magic Report

1

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-1-5 19:51:01
| Show all posts
Can you be more specific and how to use it, thank you!
Reply

Use magic Report

0

Threads

14

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-1-6 01:09:01
| Show all posts
size_t fwrite (const void * buffer, size_t size, size_t count, FILE * stream);
stream is the file you want to write, the suffix name is specified by yourself, count is the maximum number of bytes written
Reply

Use magic Report

1

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-1-6 11:48:01
| Show all posts
Thank you
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-6 16:12:02
| Show all posts
write (reinterpret_cast <char *> (&one_object), sizeof (one_object));
This is written to the hard disk in binary mode
one_object is the object to be written, haha
Reply

Use magic Report

0

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-6 17:09:02
| Show all posts
msdn
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