Results 1 to 4 of 4

Thread: Crypt function on Linux

  1. #1

    Question Crypt function on Linux

    I want to use the crypt function in a program that I am making. I seem to be having troubles using it. Can someone point me in the right direction? (I have read the man crypt)

    Thanks in advance.

  2. #2
    AntiOnline Senior Member souleman's Avatar
    Join Date
    Oct 2001
    Location
    Flint, MI
    Posts
    2,883
    Are you calling the external program properly?

    Give us an example of the code you are using, so we can see what is going on.
    \"Ignorance is bliss....
    but only for your enemy\"
    -- souleman

  3. #3
    #include <iostream>
    #include <unistd.h>

    test.cpp
    -------------------
    void main() {
    char *salt="a9";
    char *key="Secret";

    cout << crypt(key, salt)) << endl;
    exit(0);
    }

    ]$ g++ -o test test.cpp

  4. #4
    I was missing this: g++ -o test test.cpp -lcrypt. It works now :-) Thanks for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •