Thread: "int main(int argc,char* argv[])" when can I use it

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    34

    "int main(int argc,char* argv[])" when can I use it

    when do I use it?can you give me some examples?

  2. #2
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    click me

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Re: "int main(int argc,char* argv[])" when can I use it

    Originally posted by Tonyukuk
    when do I use it?can you give me some examples?
    Ever wondered why Paint is opened and loads the bitmap when you double click on a *.BMP, or why Word opens and loads the document when you double click on a *.DOC?

    That's because Explorer opens paint/Word with an extra argument - the file name. If you use argc/argv arhuments in main, you can get those arguments and then do whatever you want with the file, most commonly load it.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. int main(int argc, int *argv[])
    By salvadoravi in forum C Programming
    Replies: 5
    Last Post: 01-20-2008, 12:30 PM
  2. Replies: 14
    Last Post: 12-26-2004, 11:18 AM