Coder's Guild Mailing List

Re: Simple C Problem

Posted by James Durbin on 1999-04-21

FaNt0m wrote:
>    I have a function which is declared below; when i use
> printf("%s",ByteToString(20)); it works just fine, but when i do
> soemthing like:
> 
> char *ByteToString(unsigned char Input);
> 
> char *Output;
> Output=ByteToString(20);
> printf("%s",Output);
> 
> it outputs the text that is suppose to be outputted but it appends
> some random characters on the end which I don't want! Please help me
> if you know how...email me plz.

Are you appending a text null char '\0' at the end of the array that
ByteToString() returns?

/*
From:  James H. Durbin
Email: divine-bovine@xxxx.xxx
*/