1. I think the *C* functions will be faster than *C++*'s, e.g. printf vs cout
U can use fwrite to write ur array into a file

2. To compare ur two methods, I think the first one will not be more
slow. Because
of the *system buffer*, it is not true that there is a disk write when
there is a element outout!

2005/12/16, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
> Hello,
>
> I need to store an array in a file. The array length is 1000. I want
> the fastest disk writing method to work. I know reading/writing a big
> block from the hard disk is faster because it involves only 1 seek. I
> seem to have 2 optons :
>
> Option 1)   for(i=1 to 1000)
>                       fll<<Array[i];
>
> Option 2) Store the array contents into a single string str and then
> fll<<str;
>
> where fll is the file pointer. Which would be faster. I am concerened
> about the performance because I need to write numerical data in a file
> of size around 4 Gb. It may be possible to optimize the seek time if I
> some how know how much block size could it write in one go.
>
> Regards
> Anirudh Koul
> http://cs.dal.ca/~koul/
>
>


--
myblog: http://gnor.net/daizisheng/blog/

Reply via email to