Qbasicnews.com

Full Version: exit codes in freebasic
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
so, end # will send an exit code at the end of a program.
how can other freebasic programs detect this exit code? (preferably not using the windows api) it'd be nice if there were a cross-platform method of doing this. maybe make shell return the exit code or something?
exec(), run() and chain() return the exit code.
thanks. :bounce:
i'm trying to use this for an interface to fbc from a program. i hacked something together that works, but it's super ugly Sad :barf:
there must be a better way of doing this, but it eludes me Sad
Code:
type returntype
   erroroutput as string
   returnnum as integer
end type

declare sub compilefile(byval filename as string,byval options as string,byref returned as returntype)

option escape
print "some stuffs before it ran...\nyup...\n\nblah\n\n\n\nyep :P"
dim results as returntype
line input "what file to compile?", fiel$
compilefile fiel$,"",results
if results.returnnum<>0 then
   print "error!"
   print "here's what i say to that: "; results.erroroutput
else
   print "everythings good!"
end if
sleep

sub compilefile(byval filename as string,byval options as string,byref returned as returntype)
   oldcsrlin=csrlin
   oldpos=pos
   color 0
   a=exec("c:\\fb\\fbc.exe",filename+options)
   for i=oldcsrlin to csrlin-1
      lien$=""
      for f=iif(i=oldcsrlin,oldpos,1) to 80
         lien$+=chr$(screen(i,f))
      next
      outpu$+=rtrim$(lien$)+"\n"
   next
   outpu$=left$(outpu$,len(outpu$)-1)
  
   numspaces=((csrlin)-oldcsrlin)*80+(pos-oldpos)
  
   locate oldcsrlin,oldpos:print string$(numspaces," "):locate oldcsrlin,oldpos
   color 7
   returned.erroroutput=outpu$

   returned.returnnum=a
end sub
You are writing a ide with wx-c.dll for purebasic do ya... :wink:
8)
Keep up the good work Big Grin
shhhhhhhhhh!

not really, i'm just porting vongodric's code since he used wxwidgets Tongue

too bad it's so long... i've been working on it for a week Tongue

most of the interface is ported, just have to port the edit & view menu functions and the compile menu functions, which are pretty straightforward (except for the compiling itself since it uses a non-ported function, hence the need for this)
8)
It would be really great if fb would get a multiple platform ide...

BTW: did you solve the problem with the non existent wx scintilla control on linux?
can't with this port i'm working on Sad
like i said wxstyledtextctrls aren't working under linux Sad
don't know why, maybe wxNET doesn't support them...

you're welcome to try to get them to work though :wink:
ok a bit of digging reveals this:
Quote:

wxStyledTextCtrl


Requires contrib/stc, and --enable-stc build flag.

i never got the thing to build, i dunno if they didn't build the release version with support for it or what, but if someone else could compile it with said build flag, it'll make me feel worse when it doesn't work Tongue