I'm basically new to C.
I have a 64-bit Windows7 with 64 GB RAM and 240 GB SSD.
I work with an acquisition board that stores acquired data in 2 internal FIFOs and then passes the data to the RAM (so I can potentially acquire, let's say, 60 GB of data).
What I'm not able to do is to use the fwrite
function in order to write a binary file with a size bigger than 4 GB.
Here's my variables:
static UINT64 *rbuffer12 = NULL;
static UINT64 *rbuffer34 = NULL;
FILE *fd_raw, *fd_raw2;
UINT64 nacq = 2000;
ICS1555_ULONG_T bufferLength12, bufferLength34;
So, focusing on what happens in FIFO #1, the board makes nacq
acquisitions of size bufferLength12
and stores all the stuff in the RAM using the memory pointed by rbuffer12
.
bufferLength12 = 524288;
acq_length = 524288 / (channels_number * 2 * 4);
nBytes = bufferLength12 * 4;
rbuffer12 = (UINT64 *) malloc(nacq*nBytes);
memset(rbuffer12, 0, nacq*nBytes);
for (i = 0; i < 4*nacq; i++)
ReadF(h, 0, (UINT64 *) (rbuffer12 + i * bufferLength12/8), nBytes/4, NULL, 0))
Now I want to write the data to File12.bin
.
fd_raw=fopen("File12.bin","wb")
fwrite((UINT64 *) rbuffer12,8,(nacq * 4 * channels_number * acq_length) ,fd_raw);
fclose(fd_raw);
fd_raw=NULL;
When I set nacq=2000
, the file size is 4'096'000 bytes. If I try to increase this value, the program hangs and if I quit the acquisition I get a binary file with, for example, 1'960'000 bytes of dimension.
How can I have a bigger binary file?