Board index » delphi » convert ascii to binary and vs versa

convert ascii to binary and vs versa

Can anyone tell me how to convert an ascii file to Binary or a Binary file to
Ascii.  There are a few examples on the net but they only seem to take ascii
text and write and ascii file or take a binary file and write a new binary
file. I need to actually do the convertion.

I would appreciate some sample code or please point me in the direction of
some.

Thanks
Karen
Please email any responses if possible
karen_gr...@vsl.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

 

Re:convert ascii to binary and vs versa


Quote
karen_gr...@vsl.com wrote:

> Can anyone tell me how to convert an ascii file to Binary or a Binary file to
> Ascii.  There are a few examples on the net but they only seem to take ascii
> text and write and ascii file or take a binary file and write a new binary
> file. I need to actually do the convertion.

First I would like to understand your question! What's Ascii to Binary??

For example, if I have a file holding string "ABC", then what will
this be after it is converted to binary?

You might be looking for example UuDecode/UuEncode sources, I'm not
sure.

Markku Nevalainen

Re:convert ascii to binary and vs versa


Example from Pascal (DOS , not in protected mode)

Const LengthOfBuffer = $2000; { Bytes length for buffer of bin file}
Type MagBuffer = array[0..LengthOfBuffer] of Byte;
var ff:text; // Text file
Var MBuffer: MagBuffer absolute $5000:$0000; { Data in RAM }
    MZBuff:MagBuffer;

    FR: FILE of MagBuffer; { File of bin in RAM }

// open files

while not eof
readln(ff,c); writeln(c); writeln(FR,c)
................

In other words, you read the file of 1 type(text),
and write this in file of 2 type (bin).

Thanks...
klo...@tv-park.kiev.ua; (+38 044) 419-87-68 - work
klo...@maile{*word*277}.com; http://conk.com/world/klokov/ - home

Quote
>Can anyone tell me how to convert an ascii file to Binary or a Binary file
to
>Ascii.

Other Threads