Hi,
I don't know if it's a bug in php but if I do
$fp=fopen(some_file,r);
while (!feof($fp))
{
fscanf($fp, %d %d,$var1,$var2);
// some treatment
}
fclose($fp);
and the file is big enough, php eat up memory like hot cakes.
But if I do
$fp=fopen(some_file,r);
while (!feof($fp))
{
$line =
Hi,
Friday, February 27, 2004, 4:48:20 AM, you wrote:
SG Hi,
SG I don't know if it's a bug in php but if I do
SG $fp=fopen(some_file,r);
SG while (!feof($fp))
SG {
SG fscanf($fp, %d %d,$var1,$var2);
SG // some treatment
SG }
SG fclose($fp);
SG and the file is big enough, php eat up
Hi
I'm having dramers with fscanf
I have a line:
text, text, text
I can't work out how to scan removing the comma and whitespace.
the text can be absolutle anything.
at the moment I have
$array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]);
Thanks
Kris
--
PHP General Mailing List
where can i find a discription of the possible options for the sting
format in the fscanf command [ fscanf ( int handle, string format [,
string var1]) ]
For example, what means:
%s\t
or
%s\n
in the command fscanf ($fp, %s\t%s\t%s\n);
--
PHP General Mailing List
I'm starting to learn the language and I'm having a problem with fscanf as
witnessed below:
http://www.zephyr-works.com/ascii-5/dev/phpnews.phps
The output is at:
http://www.zephyr-works.com/ascii-5/dev/phpnews.php
I can't seem to get the variables to assign correctly...
The source file is:
I want to parse a file with the following syntax.
hostname|protocol|number|severity|description
Each record is on it's own line and have the fields delimited by the pipe
character |. The file may have thousands of records and I would like to
bring them into a database for reporting.
Some of
Hi Patrick,
@ 9:04:59 PM on 3/30/2001, Patrick Brown wrote:
...
hostname|protocol|number|severity|description
Each record is on it's own line and have the fields delimited by the pipe
character |. The file may have thousands of records and I would like to
bring them into a database for
Pat,
You could read the file into an array;
$aryNessus = file("/pathtofile/filename", "r");
Each row of the array then has one line from the file;
Get the record count;
$intNumRecs = count($aryNessus);
Now read through the array and extract the values;
for($i=0;$i=$intNumRecs;$i++) {
Thanks Chris,
That worked great. I didn't know that a file could be read directly into an
array.
--Pat
"Chris Fry" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Pat,
You could read the file into an array;
$aryNessus = file("/pathtofile/filename", "r");
"Kubol" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
hello
if this is really a silly problem dont blame me, i'm a newbie in php (but i'm
experienced in c++ a bit :-)
well, imagine i want to write a content of some text file word by word.
example will be more
01-03-13 05:00:01, "Yasuo Ohgaki" [EMAIL PROTECTED] wrote:
I think fscanf() is line oriented in C, isn't it? (I haven't used fscanf() for a
long time, I'm not 100% sure w/o reference.)
no, i'm sure in c fscanf reads the next string available, not first string in next line
Your $buffer should
- Original Message -
From: "Kubol" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 13, 2001 12:48 AM
Subject: Re: [PHP] fscanf
01-03-13 05:00:01, "Yasuo Ohgaki" [EMAIL PROTECTED] wrote:
I think fscanf() is line oriented in C, isn't it? (I
hello
if this is really a silly problem dont blame me, i'm a newbie in php (but i'm
experienced in c++ a bit :-)
well, imagine i want to write a content of some text file word by word. example will
be more understandable
than my english:
let file.txt consists:
lenin lives
forever
i want my
Hmm..noone has any ideas on this one? Its really driving me crazy
- John Vanderbeck
- Admin, GameDesign
- Original Message -
From: "John Vanderbeck" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, February 11, 2001 10:01 PM
Subject: [PHP] fscanf problem
my code..
14 matches
Mail list logo