> -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
> di
[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 dum
fgets uses the resource created by fopen.
Read the manual:
http://it.php.net/fopen
http://it.php.net/fgets
look at the example:
Ian
On Fri, 2004-12-17 at 11:24 +0100, [EMAIL PROTECTED] wrote:
> Hi there!
>
> Can someone explain the major difference between fgets and fopen? Which is
> the
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 != '..')
{
> 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 == '.' || $
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"
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
t; 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 handling
>
>
> > Quick one, how do
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: J
> 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",
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 location"
>
> I have to read the text file of above format and display in the html file.
>
> DialogName1
11 matches
Mail list logo