H
h03Ein
Hi!
how many characters will be printed in output if our input file has
just 3 characters?
Sinppet Code :
#include<stdio.h>
main()
{
char buffer[1024];
char input[] = "some file"
FILE *fp = fopen(input , "r");
int c = fread(buffer , 1 , 1024, fp);
int i = 0;
for(i = 0 ; buffer!=EOF ; ++i)
printf("%c" , buffer);
fclose(fp);
}
the result for me is my 3 input characters in file plus lots of
strange characters why?
does fread consider EOF while reading from file?
Thanks!
how many characters will be printed in output if our input file has
just 3 characters?
Sinppet Code :
#include<stdio.h>
main()
{
char buffer[1024];
char input[] = "some file"
FILE *fp = fopen(input , "r");
int c = fread(buffer , 1 , 1024, fp);
int i = 0;
for(i = 0 ; buffer!=EOF ; ++i)
printf("%c" , buffer);
fclose(fp);
}
the result for me is my 3 input characters in file plus lots of
strange characters why?
does fread consider EOF while reading from file?
Thanks!