|
-
Jan 17th, 2004, 11:35 AM
#1
Thread Starter
Lively Member
Retrieving Arguments for Command Line App
I'm making a console window app with C#, but how do I retrieve arguments when the app runs?
DannyJoumaa
Advanced VB6 Programmer
Intermediate-Advanced VB .NET Programmer
Intermediate C# Programmer
Intermediate Win32 Developer
Beginner Mac OS X Developer
Contact: [email protected]
Favorite Sayings:
"Every time you open your mouth, you prove your an idiot."
"God is a programmer. Satan is a bug. Life is debugging."
-
Jan 17th, 2004, 12:02 PM
#2
Sleep mode
By declaring array of string in the Main Method of your app . Like this :
Code:
public static Main(string[] args)
{
'Your implementation here .
}
-
Jan 17th, 2004, 01:09 PM
#3
Thread Starter
Lively Member
lol, now I have another problem.... When I use in a void an object from one of my references, I get this:
The type or namespace name 'xxxxx' could not be found (are you missing a using directive or an assembly reference?)
I've referenced it, and I've even used the Using statement. No difference. Help is greatly appreciated,
DannyJoumaa
Advanced VB6 Programmer
Intermediate-Advanced VB .NET Programmer
Intermediate C# Programmer
Intermediate Win32 Developer
Beginner Mac OS X Developer
Contact: [email protected]
Favorite Sayings:
"Every time you open your mouth, you prove your an idiot."
"God is a programmer. Satan is a bug. Life is debugging."
-
Jan 17th, 2004, 01:12 PM
#4
-
Jan 17th, 2004, 02:39 PM
#5
Thread Starter
Lively Member
got that prob fixed, but alas, another question (three of em)
1. How do I clear the command window when developing a console app?
2. If there were no arguments passed, how an I figre that out?
3. If there was an argument passed, how do I parse it?
DannyJoumaa
Advanced VB6 Programmer
Intermediate-Advanced VB .NET Programmer
Intermediate C# Programmer
Intermediate Win32 Developer
Beginner Mac OS X Developer
Contact: [email protected]
Favorite Sayings:
"Every time you open your mouth, you prove your an idiot."
"God is a programmer. Satan is a bug. Life is debugging."
-
Jan 17th, 2004, 02:47 PM
#6
Sleep mode
Originally posted by Danny J
1. How do I clear the command window when developing a console app?
This has been posted here couple of times . Do a search . 
2. If there were no arguments passed, how an I figre that out?
If (arg==null)
do this
3. If there was an argument passed, how do I parse it?
You can handle the argument array as any other string array . Ex .
foreach (string s in args)
{
s=s.remove(...,....)
Console.WriteLine(s);
}
You have other options like (storing them in arraylist , or hastable ...etc)
-
Jan 17th, 2004, 02:50 PM
#7
Originally posted by Danny J
got that prob fixed, but alas, another question (three of em)
I'd suggest buying a book, alot of this will be answered.
2. Check the size of the array
3. Depends on what kind of arguements you want your program to except.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|