Php fgetc Function

Source: Internet
Author: User

Php fgetc Function

Fgetc
(PHP 4 and PHP 5)

Fgetc-get the character pointer from the file

Description
String fgetc (resource $ processing)
Gets a character pointer from a given file.

Parameters

Handle
The file pointer must be valid and must point to a file that successfully opens fopen () or fsockopen () (and has not closed fclose ()).


Return Value
Returns a string containing a single character to read the file pointed by processing. Returns the false eof analysis.

Warning
This function may return a Boolean error, and can return a non-Boolean value calculated as false, such as 0 or "". Read some Boolean values carefully for more information. Use the ===operator to test the return value function.

Instance

Example #1 fgetc ()

$ Fp = fopen('somefile.txt ', 'R ');
If (! $ Fp ){
Echo 'could not open file somefile.txt ';
}
While (false! ==( $ Char = fgetc ($ fp ))){
Echo "$ charn ";
}
?>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.