Thread: <ctime>-stuff

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    367

    <ctime>-stuff

    How can I use the <ctime>-library to make my program run in one way the first day, another way the second day, and a third way the third way, and then start all over again, for example?

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    305
    youll probably need file i/o or code into the program the day of compilation, than calculate the number of days.

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    The ctime header offers a tm struct which can be used to acquire the current day. You'll have to save the values of this struct before the program ends or what you want will not work, so all you do is read the data that was last saved and if it is the next day, react accordingly. For further information on how to use the tm struct, consult google.

    -Prelude
    My best code is written with the delete key.

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    305
    just in case you dont know who the infamous google is: http://google.com

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Well I'm not 100% sure of what you're talking about. If you mean to act diffeently each USE, then you just get some of the file I/O going to keep track of number of uses. Then you use % to divide it by three and get the remainder - then you determine which use it is, and then send it off to one of three functions. If you mean literally the 3 days, then you use the date, and then continue as above.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tab key stuff. C+WinAPI is killing me. Please help.
    By Templario in forum Windows Programming
    Replies: 5
    Last Post: 11-21-2002, 03:35 PM
  2. arguments, directories and stuff...
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 06-26-2002, 05:46 PM
  3. Your stuff
    By smog890 in forum C Programming
    Replies: 6
    Last Post: 06-13-2002, 11:50 PM
  4. Linked lists and file i/o, and some other stuff
    By ninja in forum C++ Programming
    Replies: 9
    Last Post: 05-19-2002, 07:15 PM
  5. Stocks 'n' stuff...
    By Cheeze-It in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 09-20-2001, 05:36 PM