New topic: 

Command line handling in console applications

<http://forums.realsoftware.com/viewtopic.php?t=46301>

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        zorro          Post subject: Command line handling in console 
applicationsPosted: Fri Dec 21, 2012 1:25 am                         
Joined: Wed Sep 12, 2012 2:17 am
Posts: 3                Hello everyone,

While trying the PluginConverter in the PluginSDK 2012r1, I've stumbled upon a 
bizarre fact about command line handling in console applications.
Given the following code:
dim i As Integer
print "Args:"
for i=0 to args.ubound
  print str(i)+": "+args(i)
next


When run on Mac OS X it gives the following output:
deathstar:My application zorro$ ./My\ Application "hello world"
Args:
0: ./My Application
1: hello world
2:


When run on Linux:
root@debian:/tmp/Builds - untitled.rbp/Linux/MyApplication# ./MyApplication 
"Hello world"
Args:
0: /tmp/Builds - untitled.rbp/Linux/MyApplication/MyApplication
1: Hello world
2:


And when run on Windows Xp:
C:\My Application>"My Application.exe" "Hello world"
Args:
0: My Application.exe
1: Hello world


Is it a bug in RealBasic, or have I missed something?   
                             Top                simulanics          Post 
subject: Re: Command line handling in console applicationsPosted: Fri Dec 21, 
2012 1:50 am                         
Joined: Sun Aug 12, 2007 10:10 am
Posts: 875
Location: Boiling Springs, SC                You are looking at the 3 shells 
between all 3 systems...

arg 0 = location to the executable as the OS sees it
arg 1 = the 1st arguement you passed

if you had passed 'app.exe -r x:50 "file name.txt"'

youde see index 0 as the app itself

1 = -r
2 = x:50
3 = file name.txt

*Note quotes allow for spaces in the arguements...otherwise space is the 
delimeter between the arguements...

It's okay..there's always something new to learn...I learn something everyday!  
   
_________________
Matthew A. Combatti
Real Studio 2012 r1.2
Visit Real Studio Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8 Beta
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS
~All REAL Compatible~  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to