VOGONS


First post, by curvedline

User metadata
Rank Newbie
Rank
Newbie

xtree and dosbox has a small problem that took me a year to find
CALL SetColor.BAT 1 32

SetColor.BAT
echo [%1;%2m
echo [2A
GOTO :EOF >nul

all external batches need GOTO :EOF >nul at the end for xtreegold to return to the caller

Reply 1 of 3, by mbsystem

User metadata
Rank Newbie
Rank
Newbie

or by ending the .bat file with the character 1A, using a hex editor. Some older text editors were capable of preserving this invisible character in Windows.

Reply 2 of 3, by analog_programmer

User metadata
Rank Oldbie
Rank
Oldbie
mbsystem wrote on Yesterday, 15:17:

or by ending the .bat file with the character 1A, using a hex editor. Some older text editors were capable of preserving this invisible character in Windows.

Yep, this also apply to old DOS text editors. And the character for EOF (0x1A) is equal to <Ctrl>+<Z> key combination.

The word Idiot refers to a person with many ideas, especially stupid and harmful ideas.
This world goes south since everything's run by financiers and economists.
This isn't voice chat, yet some people overusing online communications talk and hear voices.

Reply 3 of 3, by DaveDDS

User metadata
Rank Oldbie
Rank
Oldbie

People sometimes ask "Why do text files have the EOF character?" (^Z - 0x1A)

This dates back to very early editions of DOS (and even some pre-DOS "personal" OSs like CP/M).

These systems did not track or know the size of files to the byte level.
Files were allocated in sectors (usually 512 bytes) and early OS didn't have the capability to make files NOT a multiple of 512 bytes.

Executables were't a problem, the file contained all the code and static data that was needed and "extra garbage" in the last sector was not different that uninitialized memory (could be anything).

Text however has a problem ... suppose you make a text file containing just "Hello World" - you don't want to process such a file in 512 byte "chunks".
So... the idea of a "text EOF" character - in the above example "HelloWorld"^Z would be written to the file, and the OS would know that when processing a text file, ^Z means "END".

I actually use behavior in ImageDisk .IMD files - although the file is "binary in content", it begins with a few lines of text:
Line1 = ImageDisk version and date/time file was created.
Line2+ = Text comment/description provided by user.
^Z (0x1A) EOF
... actual ImageDisk binary image data follows (up to physical EOF)

This has the nice benefit that you can simply TYPE an .IMD file to see when it was made and how the maker described it!

https://dunfield.themindfactory.com ; "Daves Old Computers" ; SW dev addict best known:
ImageDisk: rd/wr ANY floppy PChw can ; Micro-C: compiler for DOS+ManySmallCPU ; DDLINK: simple/small filetransfer(w/o netSW)via Lan/Lpt/Com