Generate byte pattern to stdout
[page last modified 2022-04-21]

This is a Windows command line tool (32 and 64 bit versions provided) to generate a byte pattern to stdout.  It is a rewrite, in Microsoft C, of an ancient mid 80's DOS ".com" program written in 16-bit Microsoft assembly.  Its command line syntax is weird (carried over from the original) so be careful.

Mostly what I use this for is to write huge test files with known patterns.  An example of that would be:

   C>stdout 100g ff 00 >100gig.bin
The first argument is the size of the output, but only if the first argument starts with a 0-9.  The size is parsed as a decimal number.

Subsequent arguments generate data bytes that are repeated to create the requested size of output.  These values are interpreted as hex.  Also quoted strings can be used, or @file to read a file in binary.

The stdout.txt file distributed with the package:

For latest version go to stdout.exe is a command line program to generate a pattern of data bytes to the standard output device -- it can create large files very quickly. Usage: stdout {-opts} {file-size{#}{*}} hex{L#}|{L}"string"|@{file} ... -opts: -h (for debug) -- writes output bytes as ascii hex. {file-size{#}{*}}: Present only if first argument starts with 0..9. This is a decimal number setting the output size in bytes. Optional # may be k,m,g,t,p,e (k=1000, m=1000**2, g=1000**3, etc), or ki,mi,etc for ki=1024, mi=1024**2,etc. If "*" is appended, the output is file-size times the size of the data that follows. hex|{L}"string"|@{file}: If hex, must be a hex number (eg. 8f) up to 64-bits. The hex value is stored low->high order, with high order zeros omitted (so 88 will store 1 byte). To control the byte(s) output, "L#" may be appended, where # is a value from 0 to 8. "string" is an ascii string, L"string" is a UTF-16 string. All C escape sequences are recognized (eg \r,\n,\0,\a,\0xff, etc.). @{file}: Specified file (name may be in double quotes) becomes part of the data. File is read in binary mode. If @ alone, standard input is read. File name may be Unicode. Notes: (1) file-size or hex may be preceded by a base override: 0y= binary, 0t= octal, 0n= decimal, 0x= hex (Microsoft assembler standard). (2) If no data value(s) supplied (just file-size), zeroes are output. Examples: stdout 1t >test.bin Write a terabyte of 0's to test.bin stdout "abc\n" 6a Output abc and newline and 0x6a stdout 100* "abc" Output 100 copies of "abc" (300 bytes) stdout "" 0y1010 0x123 Output hex bytes a,23,1 stdout 3* @test.bin Output 3 copies of file test.bin stdout -h "" 23 "a" 45 Output the string "23 61 45" stdout 1ki 123L3 Output 1024 bytes of repeated hex 23,1,0 stdout L"123\U1234" Output wide (UTF-16) string The following files are included: stdout.c C source stdout.exe 32-bit executable x64\stdout.exe 64-bit executable stdout.txt This file The packaged .exe is small; built with a tiny standard C library. That is optional -- any Microsoft C compiler and standard library will work. Change Log ---------- Ver 2.3 Various small bug fixes. 9/14/19 Command line fetched as wide char; now @filename can be Unicode. Implemented \u \U string escape sequences. Wide strings (UTF-16) can be specified via L"string" \U >= 0x10000 generates UTF-16 surrogate pairs. Ver 2.1: Initial release. 9/1/19

Click here to download

Click here to download

Widget is loading comments...

You are visitor 3877       Go to Home Page