Exemple #1
0
        /// <summary>
        /// Writes an array of chars at the current cursor position.
        /// </summary>
        /// <param name="text">An array containing the characters to be written.</param>
        /// <param name="nChars">The number of characters to be written.</param>
        /// <returns>The number of characters written.</returns>
        public int Write(char[] text, int nChars)
        {
            if (disposed)
            {
                throw new ObjectDisposedException(this.ToString());
            }
            int charsWritten = 0;

            if (!WinCon.WriteConsole(_handle, text, nChars, ref charsWritten, IntPtr.Zero))
            {
                throw new System.IO.IOException("Write error", Marshal.GetLastWin32Error());
            }
            return(charsWritten);
        }