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

avatar

(send private message)

Posts: 933
Topics: 55

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 6 user(s) online. 0 member(s) and 6 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd