Reading from the Command line

Thread Solved

Join Date: Oct 2009
Posts: 26
Reputation: shakunni is an unknown quantity at this point 
Solved Threads: 0
shakunni shakunni is offline Offline
Light Poster

Reading from the Command line

 
0
  #1
19 Days Ago
Hey,
How do you read from the command line in C? I need to read 10 arguments from the command line. Can I use char* argv[] as a parameter in the main function to do so?

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 91
Reputation: thines01 is an unknown quantity at this point 
Solved Threads: 8
thines01 thines01 is offline Offline
Junior Poster in Training
 
0
  #2
19 Days Ago
Originally Posted by shakunni View Post
Hey,
How do you read from the command line in C? I need to read 10 arguments from the command line. Can I use char* argv[] as a parameter in the main function to do so?

Thanks.
You can use that or
int main(int argc, char** argv)

where argc is the number of command-line parameters and argv is an array containing pointers to the parameters.

argv[0] is the program name itself.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC