-----BEGIN PGP SIGNED MESSAGE-----

You are correct.  I was making specific assumptions based on the code
snippet
shown.

- -----Original Message-----
From: Lee Brinton [mailto:[EMAIL PROTECTED]
Sent: Friday, April 17, 1998 12:40 AM
To: debian-user Mailing List
Subject: RE: strcpy HELP!!!



Scott D. Killen writes:
> You are copying the string to temp2 which has not been initialized and is
a
> NULL pointer.  You need to allocate memory of at least the same size as
> temp1 to temp2 and
> this will solve your problem.

When using C library string functions always allocate memory of at least the
length of the string pointed to by temp1 plus 1 byte to hold the string
termination character '\0'.

As in:

temp2 = (char*)malloc(strlen(temp1) + 1);

- --
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Lee Brinton | [EMAIL PROTECTED]
PGP public key @ http://www.icubed.com/~6xtippet/pgp-public-key.asc
- -----------------------------------------------------------------------
The objective is not to die for your country,
but to make the enemy die for his country.
        -- Gen. George Patton
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


- --
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact
[EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQCVAwUBNTbulgrrqzzf5TWxAQEi2QP/Ye3hKW8cutHTZP415zAmxhBTdElHzJjx
e3j0Aq0MJ+gtDFcCNpraNygmoza2kc8s/wFT3k58npNELO63CaPmiFL2HJcQDiqh
BAdXHxN9toPVVrCYNNbRBK8b2gIb05nBOk6JsFzhW+uqtBv/Ha3mBT7kN/ae8/u8
w8werd/ml58=
=rj5a
-----END PGP SIGNATURE-----


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to