Login | Register   
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
Language: C++
Expertise: Beginner
Nov 7, 2000

Maximum Number of Characters

Question:
I'm reading approximately two million characters into an array. The max number of elements that Borland Turbo C++ 5.02 allows me is not enough. Can I declare this array to be a lot bigger or allocate more memory for this array?

Answer:
The maximal possible size of an array depends on the OS you're using and the compiler's setting. If it's DOS, you can't allocate such a huge array on the stack, and even dynamic allocation might not succeed. The workaround is to split the array into smaller sub-arrays, each occupying 64k or so, and swap them into a disk file (modern operating systems do that automatically but DOS doesn't). Alternatively, you can redesign your application so that it uses a smaller data structure.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap