[Tutor] Question regarding character conversion usage.

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Thu Aug 19 02:15:30 CEST 2004



On Wed, 18 Aug 2004, Steve Robb wrote:

> I have a project which requires the conversion of a file from ASCII to
> EBCDIC.  My search on google produced the code by a Don Perterson, with
> his notes re: "The arrays were taken from the Snippets collection."
> Don's work looks straightforward and compiles successfully to byte code
> when I import it.  My question is how do I use it?  What does the
> missing piece of code look like that would actually allow me to convert,
> for instance, file ascii.txt(my input) to the same file as ebcdic.txt(my
> output)?

[code cut]


Hi Steve,

The code you posted provides two functions, "AsciiToEbcdic()" and
"ebcdicToAscii()".  In particular, asciiToEbcdic() looks like a function
that can take a line of ascii, and convert it to a line of ebcdic.  So as
long as you're working with a single line of something, you should be able
to directly apply those functions.


> I understand how to open, update, and close files.  What I am not seeing
> is how I use his routines for the conversion.

Ah, ok.  Have you ready about how to apply some kind of process across a
file?

If not, you may want to look at:

    http://www.freenetpages.co.uk/hp/alan.gauld/tutloops.htm

which explains how to apply a process across a sequence, as well as:

    http://www.freenetpages.co.uk/hp/alan.gauld/tutfiles.htm

for some examples of file manipulation.


If you have more questions, please feel free to ask.



More information about the Tutor mailing list