+ 8

What is the difference between file () and fread()?

I suppose the open a file using fopen([name],r) and fread to access its contents works as well. so what is the difference to file([name])? And why these two ways?

14th Jan 2017, 9:03 PM
CodingForFun
CodingForFun - avatar
1 Resposta
+ 1
file reads the whole of the file into an array. fread will read up to a set byte length. with file, each line is an array key; knowing which lines you need, you can print those lines. Or, you can loopthe pointer and print the whole of the document.
14th Jan 2017, 10:10 PM
Louis Milotte
Louis Milotte - avatar