Re: Code Execution Problem
- Posted by jjnick at cvn.com May 10, 2001
- 476 views
This is a multi-part message in MIME format. ------=_NextPart_000_002A_01C0D9B2.9EC9B840 charset="iso-8859-1" Just a suggestion . . . I recommend using the API calls for = input/output to files . . . Some combatibility issues with Win2000 . . = . In theory, if you use API calls, you can be rest assured that your = program won't break down the road, in theory of course . . . ----- Original Message -----=20 From: idget3 at netzero.net=20 To: EUforum=20 Sent: Thursday, May 10, 2001 7:57 AM Subject: Code Execution Problem as good at it as you guys. I am trying to make a program that will open = a saved file in win32lib.ew. It saves by just writing to a file using = puts(). It writes setText(variable,text). When it opens, it reads the = code, saves the code to a variable, then it's supposed to execute the = code. But I don't know how to execute the code stored in the variable. = Will someone please tell me how? sequence FileTypes FileTypes =3D{"Web Pager Files",".WP"} procedure onClick_MenuOpen() object temp =20 integer handle sequence fName, buffer object data =20 fName =3D getOpenFileName( mainwin, "", FileTypes ) =20 if length( fName ) =3D 0 then return end if handle =3D open( fName, "r" ) buffer =3D {} while 1 do data =3D gets(handle) if atom(data) then exit end if =20 buffer =3D buffer & data end while close( handle ) -- Problem: Execute code stored in "buffer" =20 end procedure onClick[ MenuOpen ] =3D routine_id( "onClick_MenuOpen" ) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ------=_NextPart_000_002A_01C0D9B2.9EC9B840 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type = content=3Dtext/html;charset=3Diso-8859-1> <META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>Just a suggestion . . . I = recommend using the=20 API calls for input/output to files . . . Some combatibility = issues with=20 Win2000 . . . In theory, if you use API calls, you can be rest assured = that your=20 program won't break down the road, in theory of course . . = .</FONT></DIV> <BLOCKQUOTE dir=3Dltr=20 style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; = BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV> <DIV=20 style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20 <A title=3Didget3 at netzero.net=20 href=3D"mailto:idget3 at netzero.net">idget3 at netzero.net</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A = title=3DEUforum at topica.com=20 href=3D"mailto:EUforum at topica.com">EUforum</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Thursday, May 10, 2001 = 7:57=20 AM</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Code Execution = Problem</DIV> <A = writing=20 to a file using puts(). It writes setText(variable,text). When it = opens, it=20 reads the code, saves the code to a variable, then it's supposed to = execute=20 the code. But I don't know how to execute the code stored in the = variable.=20 Will someone please tell me how?</FONT></DIV> <DIV> </DIV> <DIV><FONT color=3D#000000 <DIV><FONT color=3D#000000 = size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>sequence FileTypes</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2>FileTypes =3D{"Web Pager=20 Files",".WP"}</FONT></DIV> <DIV> </DIV> <DIV><FONT color=3D#000000 size=3D2>procedure = onClick_MenuOpen()</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>object temp</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2> = <BR> =20 integer handle<BR> sequence fName,=20 buffer<BR> object=20 data<BR> </FONT></DIV> <DIV><FONT color=3D#000000 size=3D2> fName =3D = getOpenFileName( mainwin,=20 "", FileTypes )<BR> <BR> if = length( fName=20 ) =3D 0 then<BR> =20 return<BR> end if</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT><FONT color=3D#000000=20 size=3D2><BR> handle =3D open( fName, "r"=20 )<BR> buffer =3D=20 {}<BR> while 1=20 = do<BR> &= nbsp; =20 data =3D gets(handle)<BR> if = atom(data)=20 = then<BR>  = ;=20 exit<BR> end if</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> <FONT color=3D#000000 = size=3D2> =20 <BR> buffer =3D buffer & = data</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2> end = while</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2> close( handle=20 )</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2><STRONG><FONT size=3D3><FONT = color=3D#ff0000>--=20 Problem: Execute code stored in = "buffer"</FONT><BR></FONT></STRONG> =20 <BR>end procedure<BR>onClick[ MenuOpen ] =3D routine_id( = "onClick_MenuOpen"=20 Wanna Throw That PC Out the Window? Not yet. First, check our technology forum for help. <A = href=3D"http://topica.com/u/?b1dd66.b2A1yr">http://topica.com/u/?b1dd66.b= 2A1yr</A> Or send an email To: EUforum-unsubscribe at topica.com This email was sent to: jjnick at cvn.com <A = ------=_NextPart_000_002A_01C0D9B2.9EC9B840--