--- In [email protected], giovanni manzoni <giovy_bg2...@...>
wrote:
>
> Hi,
> But kernel/linux, allow read a file big much more than the the free
space in ram + swap space???
>
Hi
No ! I read only 1024 bytes by 1024 the entire file. Once the 1024
bytes read, they are sent to an FPGA via the FoxBonne and then
destroyed.
see sample of code
#define READ_BLOCK_DATA 1024
bool transfert_satet_file(char *filename)
{
size_t result;
long data_count = 0;
short buffer_data[READ_BLOCK_DATA];
FILE *stream = NULL;
size_t result;
//ouverture du fichier
stream = fopen(p_element->filename, "r");
if (stream != NULL)
{
fseek(stream, 0, SEEK_SET);
data_count = 0;
while (!feof(stream))
{
result = fread(buffer_data, sizeof
(short), READ_BLOCK_DATA, stream);
if (result != data_read_count)
{
printf("(%ld -> %ld)\n",
result, data_read_count);
}
//write to FPGA
//lp_fox->set_tab_reg(FOX_REG_MEMORY,
buffer_data, result);
data_count += result;
}
fclose(stream);
}
}