-Original Message-
From: Per Eriksson [mailto:[EMAIL PROTECTED]
Sent: Friday, November 23, 2007 7:15 AM
To: php-general@lists.php.net
Subject: [PHP] File handling and different character sets
Hi,
I would like to know how you work with the PHP Directory Functions and
different
Hi,
I would like to know how you work with the PHP Directory Functions and
different character sets. If I am having a professional view,
well-written code should be able to handle file systems in different
character sets.
http://se.php.net/manual/sv/ref.dir.php
Is there a way to write code for
Hi there!
Can someone explain the major difference between fgets and fopen? Which is
the best together with plain textfiles? and why?
eof and feof. What's the difF? *don't get it*
When using fget. Is it something special you should think when taking care
of line-breaks? (/n, /r/n ...)
/G
--
fgets uses the resource created by fopen.
Read the manual:
http://it.php.net/fopen
http://it.php.net/fgets
look at the example:
?php
$handle = fopen(/tmp/inputfile.txt, r);
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
echo $buffer;
}
fclose($handle);
?
Ian
On Fri,
[EMAIL PROTECTED] wrote:
Hi there!
Can someone explain the major difference between fgets and fopen? Which is
the best together with plain textfiles? and why?
fgets can be handy to read a large file one LINE at a time.
This is most useful in files that are line-based, such as SQL data dumps,
How do i delete all file in a directory???
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
How do i delete all file in a directory???
You could use a function like this:
(html code at end)
function delFiles($filter, $sDir) {
$cDirectory = includeTrailingSlash($sDir);
$handle = opendir($cDirectory);
while ($file = readdir($handle))
{
if ($file == '.' ||
This one time, at band camp,
Kenneth Suralta [EMAIL PROTECTED] wrote:
How do i delete all file in a directory???
bit ugly but...
function del_dir($dirname) {
$dh = opendir($dirname);
while(false !== ($file = readdir($dh)))
{
if($file != '.' $file != '..')
{
Justin,
Option b. delete all AFTER foo, I.E. truncate the file directly after
foo. Leaving foo and all the data before foo untouched.
Jeff
-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: 29 November 2002 04:29
To: Jeff; [EMAIL PROTECTED]
Subject: Re: [PHP] File
]]
Sent: 29 November 2002 04:29
To: Jeff; [EMAIL PROTECTED]
Subject: Re: [PHP] File handling
Quick one, how do i read a file for a key word, say TEXt, and the
delete
the rest of the remaining file?
Do you mean:
a) how do i make sure a word (eg foo) is in a file, and if it is, delete
all
on 29/11/02 7:06 PM, Jeff RingRose ([EMAIL PROTECTED]) wrote:
Justin,
Option b. delete all AFTER foo, I.E. truncate the file directly after
foo. Leaving foo and all the data before foo untouched.
And what happens if there are more than one occurrence of foo? I assume
you mean the first
loop through the file line by line explode()ing every line with TEXt
in it. Then, if retrning array count is bigger than one, unset() the key
one and break the loop. All read OVERWRITE in the original file.
Sorry, too lazy writing the code here :)
--
Maxim Maletsky
[EMAIL PROTECTED]
Jeff
Quick one, how do i read a file for a key word, say TEXt, and the delete
the rest of the remaining file?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Quick one, how do i read a file for a key word, say TEXt, and the delete
the rest of the remaining file?
Do you mean:
a) how do i make sure a word (eg foo) is in a file, and if it is, delete
all contents of the file except the word foo OR
b) how do i search a file for the word foo, and
Dear All,
Greetings.
Please let me know if the following can be done with php. All I need to do is this,
Just assume that I have a text file with a separator like |
It would be something like this
ImagePath | DialogName | Dialog locationpath
I have to read the text file of above
On Thu, 16 May 2002, karthikeyan wrote:
Just assume that I have a text file with a separator like |
It would be something like this
ImagePath | DialogName | Dialog locationpath
I have to read the text file of above format and display in the html file.
pimg src =ImagePath1 a
16 matches
Mail list logo