示例#1
0
        public static int fpassthru(Context ctx, PhpResource handle)
        {
            PhpStream stream = PhpStream.GetValid(handle);

            if (stream == null)
            {
                return(-1);
            }
            if (stream.IsText)
            {
                // Use the text output buffers.
                int rv = 0;
                while (!stream.Eof)
                {
                    string str = stream.ReadMaximumString();
                    ctx.Output.Write(str);
                    rv += str.Length;
                }
                return(rv);
            }
            else
            {
                // Write directly to the binary output buffers.
                return(stream_copy_to_stream(stream, InputOutputStreamWrapper.ScriptOutput(ctx)));
            }
        }