Thread: fclose() error

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    22
    Rep Power
    0
    My pcnum.txt contains the number 1855.
    My script= <? $file=fopen("pcnum.txt","r+"); $Count=fread($file,filesize("pcnum.txt")); fclose($file); ?>
    The problem is it doesn't work!
    If I comment out //fclose($file) then its Ok.
    However, I then wish to reopen the file and increment = $Count += 1;
    Question(s): Can anyone see problem in above script ?
    2) Do I REALLY need to close the file before 'opening' for the write?
    Many thanks
    Redhat Linux 6.0 - Apache 1.3.12 - PHP Mod 3.0.7
    ------------------
    With my kind regards,
    Peter.

    [This message has been edited by pjlewis (edited July 06, 2000).]
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    24
    Rep Power
    0
    My script= <? $file=fopen("pcnum.txt","r+"); $Count=fread($file,filesize("pcnum.txt"); fclose($file); ?>

    You're missing a bracket!

    ------------------

    - weeder
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    22
    Rep Power
    0
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by weeder:
    My script= <? $file=fopen("pcnum.txt","r+"); $Count=fread($file,filesize("pcnum.txt"); fclose($file); ?>

    You're missing a bracket!

    [/quote]
    Thanks, Sorry, my script does have the bracket. I forgot it in the post :-0
    Peter

    ------------------
    With my kind regards,
    Peter.

Similar Threads

  1. Codepupil
    By Adachic in forum C Programming
    Replies: 3
    Last Post: February 6th, 2004, 06:50 PM
  2. syntax error : identifer 'Hole'
    By bootrecker in forum C Programming
    Replies: 2
    Last Post: February 2nd, 2004, 08:08 AM
  3. Replies: 4
    Last Post: January 28th, 2004, 08:29 AM
  4. mysql: getting error description from error code
    By laker in forum PHP Development
    Replies: 1
    Last Post: January 21st, 2004, 06:03 AM
  5. I don't know what this error message means
    By lcham02 in forum Java Help
    Replies: 2
    Last Post: January 13th, 2004, 11:57 AM

IMN logo majestic logo threadwatch logo seochat tools logo