Click to See Complete Forum and Search --> : Crypt function on Linux
Surreal
February 26th, 2002, 07:09 PM
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. :confused:
souleman
February 26th, 2002, 07:12 PM
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.
Surreal
February 26th, 2002, 09:59 PM
#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
Surreal
February 26th, 2002, 10:06 PM
I was missing this: g++ -o test test.cpp -lcrypt. It works now :-) Thanks for your help.