...

View Full Version : fgetc or fread



nst
02-13-2006, 03:45 PM
Hi everyone,

I 'm trying to build a small app that should read data from a stock exchange text file. These look like the following


AAAP 04/02/2005 8.92 - 100 8.92 8.92 892.00 1 8.92
ABAX 04/02/2005 4.82 - 31839 4.84 4.74 153253.68 84 4.80

Do you suggest to use fgetc and read every single character after another or fread and take whole strings.
I think of using a sort of

while($one_char!="\n")
in order to read the next line. Does that seem OK to you?

Thanks.

degsy
02-13-2006, 03:48 PM
Depends on how you need the data or variables.

You could use http://uk.php.net/function.file-get-contents

nst
02-13-2006, 03:58 PM
I read:

file_get_contents -- Reads entire file into a string

I don't think that is what I am looking for.

What I need is to put some data in an array and then to a mysql table, therefore I need variables.

For instance: symbol_name($i), which will be put into a field named stock_name.
In the above example we should get
symbol_name(0) = AAAP
symbol_name(1) = ABAX
and so on.

Similar applies to $price($), etc.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum