man crypt: #define __USE_XOPEN on 64-bit systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all,

I am using
Linux hobbes 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:45:36 UTC
2010 x86_64 GNU/Linux

with manpages 
Version: 3.24-1ubuntu1

I was trying to run a simple c-program using the function crypt from
unistd.h

Tha manpages states to define the macro _XOPEN_SOURCE in order to use
this function. This works fine on a 32-bit Version of Ubuntu 10.10. On
the mentioned 54-bit system the program could not be compiled. 

On those systems you also have to define the macro __USE_XOPEN.
I attached the program. Just compile with
gcc -Wall crypter.c -lcrypt #will not work without __USE_XOPEN

Thanks a lot and best regards from Ulm,
Florian Lehmann

#include <stdio.h>
#define _XOPEN_SOURCE
#define __USE_XOPEN//needed on 64-bit
#include <unistd.h>
#include <string.h>
int main(){
  char pwd[9]="asd2/ASD";
  char sa[20];
  strcpy(sa,(char*)crypt(pwd,"xx") );
 
  printf("xx-crypted pw: %s\n",sa);

  return 0;

}

[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux