Oxygen Basic

Programming => Example Code => Topic started by: Peter on January 26, 2014, 02:10:30 PM

Title: Console
Post by: Peter on January 26, 2014, 02:10:30 PM
Deleted
Title: Re: Console
Post by: Haim on January 26, 2014, 08:59:11 PM
Thanks Peter,
the addition of console is a great contribution.

Thanks again.
Title: Re: Console
Post by: Charles Pegge on January 27, 2014, 01:51:29 AM
Thanks Peter,

We have a minimal console in inc/console.inc but yours looks like the full API.

I would however, recommend changing all the long types to sys for 64 bit compatibility.

Here are some helper functions for mundane console use:

Code: [Select]
  Function output(string bufout)
  ==============================
  static sys buflen,bufrit
  buflen=len bufout
  WriteConsole ConsOut,strptr bufout,buflen,bufrit,null
  End Function


  Function input() As string
  ==========================
  static sys blen     
  static zstring bufin[300]     
  ReadConsole ConsIn,strptr bufin,299,blen,null
  return left bufin,blen
  End Function


  Function GetKey() as sys
  ========================
  static sys blen,mode
  static zstring z[4]
  GetConsoleMode ConsIn,mode
  SetConsoleMode ConsIn,0
  ReadConsole ConsIn,strptr z,1,blen,null
  SetConsoleMode ConsIn,mode
  return ?z
  End Function