中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-11-10 15:33
47,815 topics / 349,930 posts / today 0 new / 48,291 members
DOS开发编程 & 发展交流 (开发室) » Mini Converter between Hexadecimal Character Text/Binary File
Printable Version  30,594 / 104
Floor16 zh159 Posted 2006-07-19 15:55
金牌会员 Posts 1,467 Credits 3,687
Then replace 0D0A with one or two spaces separated (2020)
Floor17 GOTOmsdos Posted 2006-07-19 15:59
铂金会员 Posts 1,827 Credits 5,154
Then this program will lack universality.
Floor18 GOTOmsdos Posted 2006-07-19 16:02
铂金会员 Posts 1,827 Credits 5,154
Your third point, converting carriage returns and line feeds to 0D0A characters makes it non-portable. For example, some programs have options to search for characters by line, which then won't work.

[ Last edited by GOTOmsdos on 2006-7-19 at 16:31 ]
Floor19 mornsmile Posted 2006-08-14 07:09
初级用户 Posts 23 Credits 147
GOTOmsdos:
bin2txt 1.0 BinToHexText convertor by grub2linux
Syntax :
bin2txt binFile textFile
binFile : binary file name.
textFile : text file name.
/killline : do not conserve RETURN & LINEFEEDs in binFile.
n : do not conserve RETURN & LINEFEADs in binFile.
add a RETURN & LINEFEED every n bytes.
/lower : in lower case.


After using it, I found a problem. When converting a bin file to a txt file, if you want to get the editor format (new line every 16 bytes), the carriage return information in the bin file must be deleted, which causes the txt2bin to be unable to restore. If there is no new line, the text is only one line, which is extremely slow to open with Notepad and not easy to browse. I wonder if there is a way to overcome this problem. It is better to directly fix the text format. Anyway, the text with a new line every sixteen bytes looks neat, and this is how the.HEX files converted by various tools are as well!
Floor20 mornsmile Posted 2006-08-14 07:18
初级用户 Posts 23 Credits 147
n : 不在 binFile 中保留回车符和换行符。每 n 字节添加一个回车符和换行符。
This function is like a chicken rib
Floor21 mornsmile Posted 2006-08-14 07:39
初级用户 Posts 23 Credits 147
Originally posted by GOTOmsdos at 2006-7-19 04:02 PM:
Your third point, converting carriage return and line feed to 0D0A characters makes it non-universal.
For example, some programs have options to search for characters by line, which won't work then..

[ Last edited by GOTO ...



This sentence is not understood. Also, having an additional option to help restore txt to bin (without causing carriage return ambiguity) is not better?

Is the modification adding a switch here? Not very familiar with C, not sure if it's this line
:(


[ Last edited by mornsmile on 2006-8-14 at 07:46 ]
Floor22 GOTOmsdos Posted 2006-08-14 11:42
铂金会员 Posts 1,827 Credits 5,154
TO mornsmile

You need to keep the carriage return and line feed, so you don't use /killline|n. If you want the editor format (newline every 16 bytes), set N to 16. If you want both the editor format (newline every 16 bytes) and the original carriage return and line feed, then after setting it up, it won't be the editor format (newline every 16 bytes)!

Whether there are line breaks or not is up to your choice.

You said:
n : do not conserve RETURN & LINEFEEDs in binFile.
add a RETURN & LINEFEED every n bytes.

This function is like a鸡肋 "

Can you please explain the reason?
Floor23 mornsmile Posted 2006-08-15 00:44
初级用户 Posts 23 Credits 147
What I mean is not to convert the 0D0A in bin to line break symbols. Otherwise, after /killline|n, it cannot be restored. Even if there is an editor, the format is not the original binary information, so it is meaningless. Of course, I mean when processing bin containing 0D0A.
Floor24 mornsmile Posted 2006-08-15 00:52
初级用户 Posts 23 Credits 147
Floor25 GOTOmsdos Posted 2006-08-15 00:55
铂金会员 Posts 1,827 Credits 5,154
n : do not conserve RETURN & LINEFEEDs in binFile.
add a RETURN & LINEFEED every n bytes.

The above is a useful feature.

If you want to keep the carriage return and line feed, then of course you don't need /killline, just keep it.
If you remove this, then if you need this function, isn't it a pity?
Floor26 mornsmile Posted 2006-08-15 01:13
初级用户 Posts 23 Credits 147
I mean, I don't know if I made it clear enough.
Just don't remove the original carriage returns.
Convert the text
0000544C4F5353206572726F72
00000053494E47206572726F72
00000000444F4D41494E206572726F72

to
0000544C4F5353206572726F720D0A00000053494E47206572726F720D0A00000000444F4D41494E206572726F72


[ Last edited by mornsmile on 2006-8-15 at 01:15 ]
Floor27 GOTOmsdos Posted 2006-08-15 01:19
铂金会员 Posts 1,827 Credits 5,154
Oh, that's the meaning..
If you think this is useful, then it can be added...
Floor28 mornsmile Posted 2006-08-15 01:22
初级用户 Posts 23 Credits 147
This is the original hexadecimal code. Please help modify it, expert.
Floor29 mornsmile Posted 2006-08-15 01:25
初级用户 Posts 23 Credits 147
Share your source code too:)
Compiled with BCB is only 9k
Floor30 mornsmile Posted 2006-08-15 01:29
初级用户 Posts 23 Credits 147
There is still confusion about the role of /killline|n in txt2bin.
Prev  1 2 3 4 5 … 7  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023