Jump to content

How do we read two fields in a file?


g_p_java

Recommended Posts

i do:


$filename = "/home/newfile.txt";

$file = fopen($filename, "r");          //fopen("c:\\data\\info.txt", "r");

fread($file, $rip." ".$rnewString . "\n");

fclose($file);

 

i take :  Warning: fread() [function.fread]: Length parameter must be greater than 0

 

What shall i correct?

 

Thanks in advance! :)

You're using fread entirely wrongly.

 

 

It takes a resource as the first parameter and a length in bytes as the second parameter.  It then reads how ever many bytes you tell it to read from the resource.

 

 

file() would be much easier to work with.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.