Hi Ashley, One thing you could try is putting non-ASCII characters in the file, i.e. above 0x7f.
I haven't played with PHP, but in python, if you are using ASCII encoding for text strings and try to load a non-ASCII character into a string, an exception is raised. Better still, tell PHP you are using UTF-8 encoding for Unicode characters and then stuff in some badly formed UTF-8 characters. Some random bytes ought to do it, as UTF-8 is fairly strict. Let us know how you go. Text encoding and decoding has always been a PITA. cheers rickw Ashley Maher wrote:
Morning, Posting here as the coders list is now dead. Using php in a web app. Reading in a large text file. Using fgets to read line by line for processing. What can I put in a test text file to get fgets to fail? Can hand indicate the condition fail but would like to trigger a "real" read failure well into the file. A lot of references about testing for failure but nothing how to trigger fgets to fail. Thanks for any hints. Regards, Ashley
-- ------------------------------------ Rick Welykochy || Vitendo Consulting The chief source of problems is solutions. -- Eric Sevareid -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html