Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Home » Tip Bank » C++
Language: C++
Expertise: Beginner
May 23, 1999

Data Files Help

Question:
I am teaching an introductory C++ course at the high school level. My textbook briefly covers data files--sequential access--but doesn't provide many examples of how to write/read multiple variables. Where would be a good place to look for example programs?

Answer:
I suspect that the reason your textbook doesn't go into much detail is because the variations are virtually endless.

One approach is simply to store data as a series of structures and calculate the offset of a specific structure and read it in to obtain that record.

But that's only one way. You could store data the same way but read the entire file into memory and save it all at once. In many cases, records may not be the same length; then you need to implement some sort of index that indicates where each record starts.

In short, I've personally spent many hours looking at code variations of data file access. But when you ask for examples, I really have to determine what sort of data file makes most sense for you.

I would check your local computer bookstore. Perhaps you can find a book on algorithms or file access that would be helpful.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date