Thread: getting input (not from main())

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    15

    Question getting input (not from main())

    a newbie question

    I try to write a program in multiple source files, the first function should get input from commend line or a given file.
    I wonder can I have argc, argv[] as a function argument to get the command line input and let main() call it...

    Thank you.

    meka

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    main() is always called first, i'm not sure if argc and argv[] are considered global to the program or local to main, but if you can't use them in another function then you can pass them to that function. Just don't change argc or argv[] or you could cause some problems.

    So you should be okay just using argc and argv[] anywhere in your program. If I'm wrong then someone will correct me ;p

    -Prelude

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Input statement problem
    By une in forum C Programming
    Replies: 3
    Last Post: 05-29-2007, 11:16 PM
  2. I would love some input on my BST tree.
    By StevenGarcia in forum C++ Programming
    Replies: 4
    Last Post: 01-15-2007, 01:22 AM
  3. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  4. EOF messing up my input stream?
    By Decrypt in forum C++ Programming
    Replies: 4
    Last Post: 09-30-2005, 03:00 PM
  5. Custom Made Safe Input Function
    By Beast() in forum C Programming
    Replies: 6
    Last Post: 08-21-2004, 10:19 PM