Thread: set flags

  1. #1
    Registered User
    Join Date
    Oct 2005

    set flags

    I would like to be able to set a flag for a program im running program backs up my files when i run it example (sudo bu.exe) will run it.But i want to set a flag instead of making a completly diferent program for removing the backups.I want to be able to type (sudo bu -a) to remove the backups when im done working in that directory

  2. #2
    Registered User
    Join Date
    Jan 2005
    Look up command line arguments. Whatever arguments you pass to the program will be saved in two variables passed to main - an int and an array of C style strings. In a simple application you have to parse the strings yourself to see if any of them are valid flags, but it normally isn't very hard.

  3. #3
    Bioport Productions
    Join Date
    Oct 2005
    a command line function has 2 arguments, an int and a char[]. Int being the number of flags that are supplied, and the char* array being the flags that were set. Setting your main() function to work with this is simple:

    int main( int argc, char* argv[] )
        // Do your code
    -"What we wish, we readily believe, and what we ourselves think, we imagine others think also."
    PHP Code:

  4. #4
    Registered User
    Join Date
    Oct 2005
    ok thank you guys

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  2. The new FAQ
    By Hammer in forum A Brief History of
    Replies: 34
    Last Post: 08-30-2006, 10:05 AM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  4. Set default directory with GetTempDir?
    By Bajanine in forum Windows Programming
    Replies: 2
    Last Post: 05-04-2003, 11:36 PM
  5. Program help
    By Trebor in forum C++ Programming
    Replies: 4
    Last Post: 06-04-2002, 03:19 PM