Re: Circle [Code] (files)

From: Sammy (samedi@dhc.net)
Date: 02/19/97


On Tue, 18 Feb 1997, Reza Nejad wrote:

> I have a really big text files to be read in:
> 
> example:
> 
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
> 
> I'm trying to read this from a text file into an array:
> 
>  a[1000][1000]

Looks like a big map.  If you're working with integers, it'll be much
easier and faster if you read and write them as integers to a binary file.
All you have to do is fwrite and fread sizeof(a).  I think.  Or
sizeof(int)*1000000 would work.

Or if you really want to use ascii, how about converting the integers into
bytes, or using bytes to begin with, if you can get away with using a
number of values less than printable ascii characters available. Then you
can still use fread and fwrite, it'll be readable and portable (tho
without the spaces), and MUCH smaller.

Sam

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST