Re: [Lug-Nuts] C problems

From: Mike Machado (mike@innercite.com)
Date: Thu Oct 21 1999 - 18:24:11 PDT


Brian Lavender wrote:

> I am trying to get this simple C program to work and no go. What
> am I doing wrong?
>
> /* Filename: crypt_test.c
> */
>
> #include <stdio.h>
> #define _XOPEN_SOURCE
> #include <unistd.h>
>
> int main (void)
> {
>
> char input[255];
> /* char output[255]; */

char *output; /* POINTER aka no memory allocated execpt 4 bytes for the
pointer */

>
> char salt[2];
>
> strcpy(salt,"ab");
> strcpy(input,"My blue heaven");
>

/* crypt() returns a POINTER to a string (just the address). It does all
the allocating of memory for us */

>
> output = crypt(input, "AB");
>
> printf("Hello crypt %s \n", output);
> }
>
> --
> Brian Lavender
> http://www.brie.com/brian/

--
Mike Machado
mike@innercite.com
InnerCite
Network Specialist



This archive was generated by hypermail 2b29 : Fri Feb 25 2000 - 14:29:07 PST