Register for your free account! | Forgot your password?

You last visited: Today at 21:42

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Getopt

Discussion on Getopt within the Coding Releases forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2013
Posts: 11
Received Thanks: 0
Getopt

Code:
func GetOpt ($option)
  local $i
  for $i = 1 to $CmdLine[0]
    if $CmdLine[$i] == $option Then
    if $i+1 > $CmdLine[0] Then
      return 1
     else
      return $CmdLine[$i+1]
    endif
    endif
  next
  return 0
endfunc
for example

Getopt("/a") Returns 'Hello' if you start the prog using 'filename /a Hello'
Getopt("/a") Returns 'Hell o' if you start the prog using 'filename /a "Hell o" '

Getopt("/x") Returns 1 if you start the prog using 'filename /x'
Getopt("/x") Retuns 0 if you start the prog using 'filename /a /v /c lalala' or no parameters

looks nice until here
but Getopt("/a") Retuns '/x' if you start the prog using 'filename /a /x'
ok you can still use 'if Getopt("/a") <> 0 Then...'

did anybody out there do something better?
Liented is offline  
Reply




All times are GMT +1. The time now is 21:42.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.