remote file access and manipulation (Beginner question)

The question is posted below… I tried this problem for 2 hours , But didn’t work.

<?php $inFile ="random.dat"; $in = fopen($inFile, "r") or die("Can't open file"); $line=fgets($in); $values=fscanf($in, "%s, %f"); echo $values ; fclose($in) ?>

Please someone help me asap!!
Thanks in Advance

Question: Create a data file containing at least 10 entries that look like this: David 99
Sue 73

Note that a compound name, like “Sue Ellen”, will cause complications because it will look like two strings and not just one. Write a PHP program that will read this file and save the contents in a new comma-delimited file: David,99
Sue,73

Give this new file a .csv extension. (If you double click on such a file, it should be opened in Excel.) Note that this file does not necessarily need an HTML document interface. Such a document could be used to specify the name of the input file, but you can also “hard code” the file names. If you do hard code the file names, then you won’t need an HTML interface to provide input.

Sponsor our Newsletter | Privacy Policy | Terms of Service