MS QuickQ(j/k) a quick question

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

I'm developing a program called PikX that's sorta like my camera.ex and
Ralf's txtshow.ex combined. Here's the syntax:

ex PikX s/l filename

s is for saving pictures, and l is for loading them. Just one problem. It
doesn't know you supplied a valid action. Here's the code:
PikX.ex:
include wildcard.e
include get.e
include graphics.e
include user.e
include image.e
object cl,fname,action,vc
sequence pic
integer fn
cl=command_line()
if length(cl)<4 then
puts(1,"\nUsage: ")
puts(1,"\nPikX s/l filename")
abort(0)
end if
action=cl[3]
fname=cl[4]
vc=video_config()
action=upper(action)
if atom(action)='S' then
pic=save_text_image({1,1},{vc[3],vc[4]})
puts(1,"\nOpening "&fname&"...")
fn=open(trim(fname),"w")
if fn=-1 then
puts(1,"\nThere was an error opening "&fname)
puts(1,"\nWhat might have occured is an access denied error")
abort(1)
end if
print(fn,pic)
close(fn)
abort(0)
elsif atom(action)='L' then
puts(1,"Attempting to read from "&fname&"...")
fn=open(fname,"r")
if fn=-1 then
puts(1,"\nThere was an error loading "&fname)
puts(1,"\nWhat might have occured is a file not found")
puts(1,"\nPlease check your typing and try again")
abort(2)
end if
pic=get(fn)
if pic=-1 then
if pic=GET_EOF then
puts(1,"Reached the end of "&fname&" too soon.")
abort(3)
elsif pic=GET_FAIL then
puts(1,fname&" does not contain a valid image.")
abort(4)
end if
end if
close(fn)
clear_screen()
display_text_image({1,1},pic[2])
if wait_key() then
end if
abort(0)
end if
puts(1,"\n"&action&": This is not a supported action")

Could y'all tell me what's wrong with it?
-------------------------------------
When it comes to programming languages, Euphoria is a cut above -
matt1278 at juno.com and matt1421 at juno.com(and soon to be
irisnmatt at prodigy.net. Then again, maybe not) Euphoria programmer

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

Search



Quick Links

User menu

Not signed in.

Misc Menu