hi all,
i have a txt file named by hello.txt
i wanna read the file untill the end of it.
i write the following simple code :
Code:
#include <stdio.h>
char outbuff[7*1024];
int main ()
{
int read_bytes,fd,write_bytes;
printf("Start reading data\n");
fd = fopen("hello.txt","r");
if (fd==NULL)
printf("error cant open the file\n");
read_bytes = fread(outbuff, sizeof(outbuff), 1,fd);
printf("the read bytes ar %d\n",read_bytes);
fclose(fd);
return 0;
}
when i run the previous program, the read_bytes variable was zero.
and also i dont know how can i read the file till the end. alll i just can imagine is that i should make a while loop?
can anyone help me please, thanks in advance