fscanf question

This is a discussion on fscanf question within the alt.comp.lang.php forums, part of the PHP Programming Forums category; In php5 I'm trying to read in a float number from an ascii file with: $n = fscanf($fp, "%...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-05-2007
Sam Waller
 
Posts: n/a
Default fscanf question


In php5 I'm trying to read in a float number from an ascii file with:

$n = fscanf($fp, "%f", $f);

where the ascii file contains this:

"....> 1.32405 </FONT></TD>"

I use fseek to go to the offset of the single space before the number and then use fscanf. But I'm
not reading the number correctly. What is the best way to get the float into php?

thanks,
Sam

Reply With Quote
  #2 (permalink)  
Old 01-05-2007
Richard Schneidt
 
Posts: n/a
Default Re: fscanf question

Sam Waller schrieb:
> In php5 I'm trying to read in a float number from an ascii file with:


>
> $n = fscanf($fp, "%f", $f);


from this line I cannot tell what you are doing.

>
> where the ascii file contains this:
>
> "....> 1.32405 </FONT></TD>"
>
> I use fseek to go to the offset of the single space before the number and then use fscanf. But I'm
> not reading the number correctly. What is the best way to get the float into php?


fscanf is fine or a regular expression might do

>
> thanks,
> Sam
>

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:07 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0