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]

Reply via email to