fgetc example


                $prevchar = $thischar;
            }

        } else {

            // Ideally we would just use PHP's fgets() function, however...             // it does not behave consistently with regards to mixed line endings, may be system-dependent             // and breaks entirely when given a file with mixed \r vs \n vs \r\n line endings (e.g. some PDFs)             //return fgets($this->getid3->fp);             while (true) {
                $thischar = fgetc($this->getid3->fp);
                if (($prevchar == "\r") && ($thischar != "\n")) {
                    // read one byte too many, back up                     fseek($this->getid3->fp, -1, SEEK_CUR);
                    break;
                }
                $buffer .= $thischar;
                if ($thischar == "\n") {
                    break;
                }
                if (feof($this->getid3->fp)) {
                    break;
                }
return $this->resetIOCodepage($cp$ret);
        }

        $multiLineStreamReader = $this->cloneInputStream($inputStream);
        if (null === $multiLineStreamReader) {
            return false;
        }

        $ret = '';
        $cp = $this->setIOCodepage();
        while (false !== ($char = fgetc($multiLineStreamReader))) {
            if (\PHP_EOL === "{$ret}{$char}") {
                break;
            }
            $ret .= $char;
        }

        return $this->resetIOCodepage($cp$ret);
    }

    private function setIOCodepage(): int
    {
        
return $this->resetIOCodepage($cp$ret);
        }

        $multiLineStreamReader = $this->cloneInputStream($inputStream);
        if (null === $multiLineStreamReader) {
            return false;
        }

        $ret = '';
        $cp = $this->setIOCodepage();
        while (false !== ($char = fgetc($multiLineStreamReader))) {
            if (\PHP_EOL === "{$ret}{$char}") {
                break;
            }
            $ret .= $char;
        }

        return $this->resetIOCodepage($cp$ret);
    }

    private function setIOCodepage(): int
    {
        
Home | Imprint | This part of the site doesn't use cookies.