Re: Faster way to write in a file



"LilacSkin" <lpaulo07@xxxxxxx> wrote in message news
Hi,

Currently, I write an signed long long in a file with the fprintf
function:

signed long long * pData = NULL;
unsigned long long k = 0;
unsigned long DataAvail = 0 ;

pDataRx = (signed long long *) malloc ( sizeof(signed long long ) *
(65536*16*8) / 8);

for ( k = 0; k < DataAvail/8; k ++ ) {
fprintf ( pFilec, "%lli\t", pData[k]);
}

The problem is that function is very very slow !

In several forums, I saw that fwrite function is better, but I don't
know how to use it.
Can you help me, please ?

Replace %lli with %llx and measure the speedup.
Is hexadecimal output acceptable to you?

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

.



Relevant Pages

  • Re: Faster way to write in a file
    ... LilacSkin wrote: ... I write an signed long long in a file with the fprintf ... signed long long * pData = NULL; ... rc = fwrite(pData, sizeof *pData, 1048576UL, pFilec); ...
    (comp.lang.c)
  • Faster way to write in a file
    ... I write an signed long long in a file with the fprintf ... signed long long * pData = NULL; ... In several forums, I saw that fwrite function is better, but I don't ...
    (comp.lang.c)
  • Re: Faster way to write in a file
    ... santosh wrote: ... I write an signed long long in a file with the fprintf ... signed long long * pData = NULL; ...
    (comp.lang.c)