Is it better to split binary files and when should I do it?

0
4
Asked By CleverWalrus42 On

I'm working on a C++ project where I need to save a lot of data into binary files. The data is generated over time and the program not only reads but also rewrites these files. I understand that fstream read functions don't load the entire file into RAM, which makes me think about the potential complications if I need to delete parts and shift everything to fill the space. I'm considering storing data in separate files, each with a header indicating their creation time, which might make it easier to locate specific data quickly. I'm curious, at what size should I think about creating a new file for better access? Would this method be effective for my needs? Thanks!

1 Answer

Answered By TechGuru99 On

Have you thought about using a database instead? If you're planning to create multiple files with headers, that might be a sign to rethink your storage method altogether.

CleverWalrus42 -

That's a good point! I started off with small data, but now that it's growing, I hadn’t even considered databases. Do you have any solid resources for learning about databases in C++?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.