Re: Faster way to write in a file
- From: Mark Bluemel <mark_bluemel@xxxxxxxxx>
- Date: Wed, 13 Feb 2008 13:40:08 +0000
santosh wrote:
LilacSkin wrote:
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 ?
size_t rc;
rc = fwrite(pData, sizeof *pData, 1048576UL, pFilec);
if (rc != 1048576) {
puts("Write error.");
/* ... */
}
How does dumping the data in binary form compare to writing a
tab-delimited textual representation?
.
- Follow-Ups:
- Re: Faster way to write in a file
- From: Morris Dovey
- Re: Faster way to write in a file
- References:
- Faster way to write in a file
- From: LilacSkin
- Re: Faster way to write in a file
- From: santosh
- Faster way to write in a file
- Prev by Date: Re: Faster way to write in a file
- Next by Date: Re: Faster way to write in a file
- Previous by thread: Re: Faster way to write in a file
- Next by thread: Re: Faster way to write in a file
- Index(es):
Relevant Pages
|