PDA

View Full Version : take binary information



neafriem
19-08-2004, 11:09 AM
My question is quite simple. If You have a network with a few computers and you move one program from one computer to another. Then the computers send a binary code, right. Can you, somehow make a program that intercept that information and save it in a *.txt file? So if you open the text file it will look something like this:
10011101010100101001101011001110101010010100110101 10011101010100101001101011001110101010010100110101 10011101010100101001101011001110101010010100110101 10011101010100101001101011001110101010010100110101 10011101010100101001101011001110101010010100110101 10011101010100101001101011001110101010010100110101 10011101010100101001101011001110101010010100110101 10011101010100101001101011001110101010010100110101 10011101010100101001101011001110101010010100110101

wilbur989
19-08-2004, 01:22 PM
My question is quite simple. If You have a network with a few computers and you move one program from one computer to another. Then the computers send a binary code, right. Can you, somehow make a program that intercept that information and save it in a *.txt file? So if you open the text file it will look something like this:
1001110101010010100110101100111010101001...

Nope, Acually while data between network connections is transfered physically in binary, it always gets translated by the network driver back into hex. Most data on the computer when siad to be in binary format is usually represented to the user in hex format. That is the reason that you hear about hex editors so much. Now you could take that hedx representation and convert it back to binary but that would be the only whay I know that you could do it..

-Jeremy

Paulius
19-08-2004, 02:02 PM
I can't imagine why you'd want that as its unreadable and inefficient, but yes you can do it with some bit fiddling like:
var
i, j: integer;
pData: pbyte;
WriteStr: string[9];
begin
pData:= @Data;
for j:= 0 to ByteCount-1 do
begin
for i:=0 to 7 do
begin
WriteStr[i+1]:= '0';
if ((pData^ shr i) and $1) = 1 then
WriteStr[i+1]:= '1';
end;
write(file, WriteStr);
inc(pData);
end;
end;
And no one converts between hexadecimal and binary, hexadecimal is just 4 bits in a row, most binary editing is done with hexadecimal values to make reading easyer

WILL
20-08-2004, 12:09 AM
I'd have to agree. Just use hex for something like that. If you need to. Even hackers would prefer that. ;)