Re: Faster way to write in a file
- From: santosh <santosh.k83@xxxxxxxxx>
- Date: Wed, 13 Feb 2008 18:17:33 +0530
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.");
/* ... */
}
.
- Follow-Ups:
- Re: Faster way to write in a file
- From: Mark Bluemel
- Re: Faster way to write in a file
- From: LilacSkin
- Re: Faster way to write in a file
- References:
- Faster way to write in a file
- From: LilacSkin
- Faster way to write in a file
- Prev by Date: Faster way to write in a file
- Next by Date: Re: c
- Previous by thread: Faster way to write in a file
- Next by thread: Re: Faster way to write in a file
- Index(es):
Relevant Pages
|