Library file

This is a discussion on Library file within the C++ Programming forums, part of the General Programming Boards category; I have one library file missing, it should contain the following functions: Code: crypt gettimeofday srandom random Can anyone tell ...

  1. #1
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318

    Library file

    I have one library file missing, it should contain the following functions:
    Code:
    crypt
    gettimeofday
    srandom
    random
    Can anyone tell me what library file is it? Maybe I even have it...

  2. #2
    Registered User
    Join Date
    Dec 2005
    Posts
    50
    Code:
    #include <stdlib.h>

  3. #3
    Moderately Rabid Decrypt's Avatar
    Join Date
    Feb 2005
    Location
    Milwaukee, WI, USA
    Posts
    300
    stdlib.h is not standard.

    use
    Code:
    #include <cstdlib>
    instead.

    [edit] for rand and srand, anyway. I don't know about the other two. [/edit]
    Last edited by Decrypt; 01-23-2006 at 07:32 PM.
    There is a difference between tedious and difficult.

  4. #4
    Registered User
    Join Date
    Dec 2005
    Posts
    50
    yes cstdlib.h is the standard one...

    ....for C++
    Last edited by what3v3r; 01-23-2006 at 09:59 PM.

  5. #5
    Advanced Novice linucksrox's Avatar
    Join Date
    Apr 2004
    Location
    Michigan
    Posts
    198
    this is the difference between c and c++. we're working with c++ so we would want to use
    Code:
    #include <cstdlib>
    maybe they're both standard though...
    you might want
    Code:
    #include <ctime>
    and for the crypt function, i couldn't help you
    anyway did that answer your question maxorator?
    Last edited by linucksrox; 01-23-2006 at 09:52 PM.
    "What are all you parallelograms doing here?" - Peter Griffin (to Joe and his wheelchair buddies)

  6. #6
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Quote Originally Posted by maxorator
    I have one library file missing, it should contain the following functions:
    Code:
    crypt
    gettimeofday
    srandom
    random
    Can anyone tell me what library file is it? Maybe I even have it...
    man crypt
    man gettimeofday
    man srandom
    man random
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  7. #7
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    >> stdlib.h is not standard.
    Yes it is. It is standard in C++, but deprecated, meaning it will still work on all standards-compliant compilers now, but maybe not in a later version of the standard. You are right that <cstdlib> is preferred in C++.

    >> yes cstdlib.h is the standard one...
    There's no such thing as cstdlib.h, it is cstdlib or stdlib.h.


    Of course, none of the names in the OP are from stdlib.h (or cstdlib) anyway, so it doesn't matter in this case.

  8. #8
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    > I have one library file missing, it should contain the following functions:
    Your question is meaningless without you also telling us which OS/Compiler you have.

    See the FAQ on what to do if you need "foo.h" but don't have it question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  3. Problems passing a file pointer to functions
    By smitchell in forum C Programming
    Replies: 4
    Last Post: 09-30-2008, 02:29 PM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  5. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 09:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21