H!

Thank you, but yuor fragment of code read all file and
I'm really want is read an integer from the file. There
are some fuction of PHP thas serve me to make that?

Rasmus Lerdorf said:
> Is your second character perhaps a 0?  That while loop is going to end
> as  soon as it gets a character that evaluates to 0.  Write it like
> this  instead:
>
> while(!feof($this->m_file)) {
>    $c = fgetc($this->m_file);
>    if(is_numeric($c)) $str .= $c;
> }
>
> -Rasmus
>
> On Sun, 16 Dec 2001, Yoel Benitez Fonseca wrote:
>
>> Hi!
>>
>> The following code fragment tries to read a sequence of digits from a
>> file but it doesn't work, only the first character is read,
>> Which is my error?.
>>
>>
>>            $str = "";
>>            while( ($c = fgetc($this->m_file)) && ereg("[0-9]", $c) ){
>>                $str .= $c;
>>            }
>>
>>
>> Thank you in advance
>>
>>


-- 
Yoel Benitez Fonseca



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to