Yahoo Answers is shutting down on 4 May 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Lv 55,927 points

Richard

Favourite answers26%
Answers1,095
  • How to deconstruct value = time(NULL) to get an actual time / date?

    Beginning C++ programmer.

    Here's the issue:

    I've got a variable grabbing time(NULL) for a pseudorandom seed in a project I'm doing. I'm using a variable because I want to know the exact seed, so that I can reconstruct the pseudorandom numbers at a later time with some modified code, so basically a verification code. I also want to use that variable return as a source to determine when the variable was grabbed (and therefore when the program was run).

    Here's some example code: (in main() and assume everything works)

    int R;

    R = time(NULL);

    srand(R);

    ... more code...

    cout << "Verification code: "<< R << "\nGenerated at: " << deconstructR();

    What I need to know is the code to use in place of deconstructR().

    the code time(R) gives me the error 'invalid conversion from int to time_t*' so the obvious is obviously wrong.

    1 AnswerProgramming & Design9 years ago