[Tutor] A file containing a string of 1 billion random digits.

Alan Gauld alan.gauld at btinternet.com
Sat Jul 17 20:06:00 CEST 2010


"Richard D. Moores" <rdmoores at gmail.com> wrote

> amount of memory my laptop has (4 GB). So my question is, how can I 
> do
> this differently? I'm pretty brand new to opening and writing files.
> Here, I can't write many shorter lines, because the end result I 
> seek
> is one long string. But am I correct?

Others have answered that but I will ask, have you considered what
you will do with this 4G string once you have created it? You will not
be able to read it back into your memory in one piece so you will
need to process it in chunks.

It may be as well considering what you intend to do with it before
creating it? There may be a better representation.

Just a thought,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list