Category talk:Plain English-output
Appearance
Source code
To write a byte to NppExec console;
To write a byte to Notepad++ console;
To write a byte to stdout:
Call "kernel32.dll" "WriteFile" with
the stdout handle [hFile] and
the byte's whereabouts [lpBuffer] and
1 [nNumberOfBytesToWrite] and
a number's whereabouts [lpNumberOfBytesWritten] and
nil. [lpOverlapped]
To write to StdOut a string;
To write a string to StdOut:
\Cluck.
Call "kernel32.dll" "GetStdHandle" with
-11 [nStdHandle = STD_OUTPUT_HANDLE]
returning the stdout handle.
Call "kernel32.dll" "WriteFile" with
the stdout handle [hFile] and
the string's first byte pointer [lpBuffer] and
the string's length [nNumberOfBytesToWrite] and
a number's whereabouts [lpNumberOfBytesWritten] and
nil [lpOverlapped]
Returning a number called error status code.
If the error status code is 0,
Put "Error writing to StdOut" into the i/o error;
Cluck;
Exit.
To read a buffer from stdin:
Put 0 into a number called lpNumberOfBytesRead.
Put 0 into a number called remaining NULL characters.
Fill the buffer with the NULL byte using 256.
Call "kernel32.dll" "ReadFile" with
The Standard Input Handle [hFile] and
The buffer's first byte pointer [lpBuffer] and
256 [nNumberOfBytesToRead] and \The buffer's length,
The lpNumberOfBytesRead's whereabouts [lpNumberOfBytesRead] and
0 [lpOverlapped = NULL]
Returning a number called error status.
If the error status is 0 [NULL],
Write "Error reading from Console." then the CRLF string to STDOUT.
If the lpNumberOfBytesRead is less than 256,
Put 256 minus the lpNumberOfBytesRead into the remaining NULL characters.
Remove trailing bytes from the buffer using the remaining NULL characters.
Subtract 2 from the lpNumberOfBytesRead.
Trim the buffer.
\Convert the lpNumberOfBytesRead to a string.
\Write "Bytes read: " then the string then the CRLF string to STDOUT.
To set up the console:
Get the Standard Input Handle.
Set the Console Code Page.
Get the Console Mode.
\Get the Standard Output Handle.
\Get the Standard Error Handle.
\Set the Console Mode.
\Get the Console Code Page.
The Standard Input Handle is a number equal to -10.
The STD_INPUT_HANDLE is a number equal to -10.
The Code Page is a number equal to 1252.
The INVALID_HANDLE_VALUE is a number equal to -1.
To get the Standard Input Handle:
Call "kernel32.dll" "GetStdHandle" with
The STD_INPUT_HANDLE [nStdHandle = STD_INPUT_HANDLE]
Returning the Standard Input Handle.
If the Standard Input Handle is the INVALID_HANDLE_VALUE,
Write "Error obtaining the Standard Input Handle."
then the CRLF string to StdOut.
\Write "STDIN HANDLE: " then the Standard Input Handle
\then the CRLF string to StdOut.
To set the Console Code Page:
Call "kernel32.dll" "SetConsoleOutputCP" with
The Code Page
Returning an number called error status.
If the error status is 0 [NULL],
Write "Error setting the Console Code Page for STDOUT. "
then "If you are using NppExec Console, it is safe to ignore this error."
then the CRLF string to StdOut.
To get the Console Mode:
Call "kernel32.dll" "GetConsoleMode" with
The Standard Input Handle [hConsoleHandle] and
A number's whereabouts \called Console Mode
Returning an number called error status.
If the error status is 0 [NULL],
Write "Error obtaining the Console Mode."
then the CRLF string to StdOut.
\Write "Console Mode: " then the Console Mode
\then the CRLF string to StdOut.
\ Change these paths if you prefer to change them.
\ It is your responsibility to clean up the output.txt file.
The output directory is a directory equal to "C:\output\".
The output path is a path equal to "C:\output\output.txt".
To write a number to the output:
Privatize the number.
Convert the number to a string.
Write the string to the console.
Write the string to the output path.
To write a number to the output without advancing:
Privatize the number.
Convert the number to a string.
Write the string to the console without advancing.
Write the string to the output path without advancing.
To write a string to the output:
Write the string to the console.
Write the string to the output path.
To write a string to the output path:
If the output directory is not in the file system,
Create the output directory in the file system.
If the output path is not in the file system,
Create the output path in the file system.
Read the output path into a buffer.
Append the string then the return byte to the buffer.
Write the buffer to the output path.
To write a string to the output path without advancing:
If the output directory is not in the file system,
Create the output directory in the file system.
If the output path is not in the file system,
Create the output path in the file system.
Read the output path into a buffer.
Append the string to the buffer.
Write the buffer to the output path.
To write a string to the output without advancing:
Write the string to the console without advancing.
Write the string to the output path without advancing.