> I just need to figure out why when using fgets() with fseek() &
> rand(), the script returns partial strings form the city names.

Because fseek doesn't necessarily put you at the start of a line.

It puts you anywhere (which could be the start, middle, 3 chars from the
end) according to the number of bytes you tell it to start at.

Then fgets reads the rest of the line.

A file that looks like this:

(numbers are the "bytes" for ease of explanation)

123456789

is going to be different to a file that looks like this:

1234
56
789

and if you tell me you want to start at "byte 5", then in file 1, that's
the middle - in file 2 that's the start of the second line (#4 is a
newline char :P).

-- 
Postgresql & php tutorials
http://www.designmagick.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to