EBCDIC Formatted File (Help Needed)

new topic     » topic index » view thread      » older message » newer message

I've got a file from a government agency that is in EBCDIC format (shoot
me now). It is almost 140MB in size. I'm trying to use Hayden McKay's
EBCDIC converter, and I'm sure it will work, but I can't even get the
raw file loaded up! I tried using "rb" and gets() but that was taking
a million years to load the file and I couldn't interrupt it nicely. Then
I tried using "rb" and getc(), but that will obviously take a million years
also, but at least I could put a tracking counter on screen and use SPACE
to stop it. Am I just going to have to be patient loading this big boy into
a variable so I can txt = ebcdic_to_ascii( txt ) it? AAARRRRRRRGGGHH!!!

Here's my program, in case anybody wants to revise/advise/contemplize.

---start
-- EBCDIC file converter

include ebcdic.e
include get.e
include graphics.e
include wildcard.e

object fn, line, junk
sequence txt, fname

txt = ""
fname = "orf850"

puts(1,"Opening " & fname & "...")
fn = open(fname,"rb")
clear_screen()

line = getc(fn)
while line != -1 do
	txt &= line
	position(1,1)
	?length(txt)
	line = getc(fn)
	junk = get_key()
	if junk = ' ' then
		line = -1
	end if
end while
close(fn)

puts(1,"Convert? (Y/N) ")
junk = wait_key()
if upper(junk) = 'Y' then
	txt = ebcdic_to_ascii( txt )
	fn = open("orf850a","wb")
	puts(fn,txt)
	close(fn)
end if

puts(1,"\nFinished.")
junk = wait_key()
---end

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu