Re: Open command in wxEuphoria

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

Jesse Adkins wrote:
> 
> I actually did a little modification of my own just now. 
> }}}
<eucode>
> procedure load_project(sequence filename)
> integer fn
> object in
> 
> 	-- start with a quick sanity check
> 	if match(".rtf",filename)!=length(filename)-3 then
> 		puts(1,"not a project!\n")
> 	end if
> 	fn= open(filename,"r")
> 	while 1 do
> 		in = gets(fn)
                  if in=-1 then
                   exit
                  end if
> 		append_text(M,in)
> 	end while
> end procedure</eucode>
{{{

> (M is my TextCtrl)
> 
> The code i've got will open the file and put all of the text into the 
> TextCtrl, including the markups (the /t and /par stuff but that just needs
> a filter). However, there is another problem that arises.
> 
> I don't know how to stop append_text from getting the text in the file so, it
> eventually tries to go past what is in the file, generating a new error...
> 
> type_check failure, val is -1
> 
> I don't know how to stop the code from hitting the bottom or to check for -1.
> I've tried to set val as something and then an if statement to make it stop
> when it hits -1 but it passes it up.


Don Cole

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

Search



Quick Links

User menu

Not signed in.

Misc Menu