Do not forget, if you are going to read the contents of the file which you have already written via fwrite() or else you have to close the file first.
![]() |
|
||||||||||
|
fcloseОписаниеbool fclose ( resource handle )
Функция закрывает файл, на который указывает Возвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки. Дескриптор должен указывать на файл, открытый ранее с помощью функции fopen() или fsockopen().
fclose
sineld at sineld dot com
23-Nov-2006 04:50
Do not forget, if you are going to read the contents of the file which you have already written via fwrite() or else you have to close the file first.
mark at markvange * com
04-May-2006 09:17
It is very important to make sure you clear any incoming packets out of the incoming buffer using fread() or some equivalent. Although you can call fclose() the socket does not actually shut down until the inbound packets have been cleared. This can lead to some confusion.
williamhamby at williamhamby dot net
07-Apr-2006 06:19
Trying to understand how 'end foreach' and 'endwhile' differ, I've encountered a problem I can't solve by myself. The following is a fairly easy stock portfolio script. Everything works, except at the end where I want to calculate the average of the gains as represented by $gain[$i].
James R. Steel
28-Nov-2005 09:02
In response to kumar mcmillan 'gotcha' note below, we get a different result on a W2K machine:
kit dot lester at lycos dot co dot uk
18-Sep-2005 05:34
fclose() also clears any locks on the file, so if another process was being kept waiting for the lock to be cleared, fclose()ing will allow the other process to continue.
jricher at jacquesricher dot com
01-Feb-2005 06:06
It is a GOOD_THING to check the return value from fclose(), as some operating systems only flush file output on close, and can, therefore, return an error from fclose(). You can catch severe data-eating errors by doing this.
kumar mcmillan
30-Sep-2004 12:10
gotcha:
daniel7 dot martinez at ps dot ge dot com
10-Sep-2001 04:06
Generally, it's always a good idea to close a file when you're done with it. It's very easy for something to go wrong and corrupt a file that hasn't been closed properly. If you're concerned about efficiency, the overhead is negligible.
|