H
H
heatherr2020-04-18 17:26:29
cmd/bat
heatherr, 2020-04-18 17:26:29

Is it possible through Batch to create a .txt file filled with null bytes, size 102400 B, and when entering text, null bytes were cut / added to 102400 B?

Hello, please advise if there is a program or a solution for those who do not know how to program.

Is it possible through Batch or some other way to create a .txt file exactly 102400 B in size, filled with null bytes, so that the size always remains the same?
That is, if you enter / delete text in this .txt, nul bytes are truncated / added, the file size always remains 102400 B.
Let nul bytes at least be truncated when adding text to 102400 B, this is more priority than adding.

And if possible, how would such a script look like in .bat?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2020-04-18
@rPman

create a file dd if=/dev/zero of=file bs=102400 count=1
edit the file - it all depends on what kind of editing it is, because you can simply open a regular text editor to a temporary file and, upon closing, pad the rest with zeros with the same dd
usual text editors in replacement mode can normally handle the presence of zeros in the file, with the exception of newline characters, here you need to check each one separately.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question