Register | Login
Forum Index > Samples > Console input/output
Author Message
Pages: 1
Admin
Site Admin

avatar

(send private message)

Posts: 923
Topics: 54

Location:
OverHertz Studio
[1166] Console input/output - posted: 2012-05-19 02:04:55
A sample compilable with 1.1.34.7+

Code:
program WIN32CUI 'test';

#include 'ch.zir';

char buf[32];

repeat {
  print('Enter command: ');
  edx = gets(@buf, 32);
  al = [edx];
  
  case (al) {
    
    state "q":
      if (strCmp(edx, 'quit') == true) {
        print('Goodbye!\r\n');
        break 1;
      } else {
        goto @casedef;
      }
      break;
      
    state "h":
      if (strCmp(edx, 'help') == true) {
        print('  ********** HELP **********  \r\nhelp\t-\tDisplay this help\r\nquit\t-\tQuit application\r\nspam\t-\tPrint 1000 spam messages\r\n/ ************************** /\r\n');
      } else {
        goto @casedef;
      }
      break;    
      
    state "s":
      if (strCmp(edx, 'spam') == true) {
        for (ecx = 1 to 1000) {
          print('spam ', ecx:int, '\r\n');
        }
      } else {
        goto @casedef;
      }
      break;
      
    default:
      @casedef:
      print('Unknown command: ', edx:string, '\r\n');
      break;
    
  }
  
};

wait_key();
ExitProcess(0);




Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 1 user(s) online. 0 member(s) and 1 guest(s)
Most users ever online was 533, May 5, 2016, 7:19 am.


Statistics:
Threads: 223 | Posts: 1835 | Members: 50 | Active Members: 50
Welcome to our newest member, NobodyAtWork
const Copyright = '2011-2017 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd