Im developing software that will handle alot of files & i was wondering what the best way of doing this is. There's a couple of things that are important.

1) i want to be able to access the files easily and have them grouped.

2) i want the files to be in human-unreadable format

It would be nice to have one big file containing many small ones & i can just pull out the bits of data i need when i want. Any advice or links to good tutorials would be much appreciated! thanks

Recommended Answers

All 5 Replies

Your question is bit open ended and not fully clear, but how about a file that contains the names of all the various data files. You open and read that, storing each file name into an array element. You can then open whichever data file(s) you need.

Perhaps even have an array of filestream variables to correspond to the file names?

Perhaps give us a bit clearer explanation of what you're trying to do?

i want my program to pull out very specific small strings from files, but i dont know whats the best way of going about this. ive written a function that can get a specific line from a file, but its hard to keep track of where relevant data is. ive started to store different types of files in different directories, but i dont want to have too many, especially when the files are so small.

i want my program to pull out very specific small strings from files, but i dont know whats the best way of going about this. ive written a function that can get a specific line from a file, but its hard to keep track of where relevant data is. ive started to store different types of files in different directories, but i dont want to have too many, especially when the files are so small.

Well you can maintain an index file which holds the indexes where in the key is the type of record and the key value is the position of the record in the record file.In this way you will limit the number of files to just two,one with the data and another with the index.

I can see what your saying, but id really have no idea how to implement it. do you think it would be possible to simulate a file within a file? and have my program recognise when to stop reading from it?

I can see what your saying, but id really have no idea how to implement it. do you think it would be possible to simulate a file within a file? and have my program recognise when to stop reading from it?

By your previous posts its clear that you can group your data,that means your data is divided in some form of units say block of data.Just spend some time analyzing this block and you will find a data within it which is unique to it.Mark this as key and make effective use of it,like an identity to the whole record.
In the index file just hold these keys and the positions in which corresponding block is stored in main file (use seekg to find position).
With the above information add two things 1)Your time in studying the concepts 2)Your coding creativity and you are done. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.