Re: set char to empty
From: Martin Ambuhl (mambuhl_at_earthlink.net)
Date: 08/02/04
- Next message: Magix: "Re: set char to empty"
- Previous message: Magix: "<CR> into string"
- In reply to: Magix: "Re: set char to empty"
- Next in thread: Richard Bos: "Re: set char to empty"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 02 Aug 2004 05:22:04 -0400
Magix wrote:
> "Martin Ambuhl" <mambuhl@earthlink.net> wrote in message
> news:2n60itFsaj2rU1@uni-berlin.de...
>
>>Magix wrote:
>>
>>
>>>Hi,
>>>
>>>How do I set the char [ ] to empty ?
>>>
>>>let say I have,
>>>char test[20];
>>
>> char test[20] = "";
>>if you want to initialize it to an empty string.
>>
>>
>>>can I do like this :
>>>*test = NULL;
>>
>> *test (or test[0]) is a char.
>> NULL is a pointer.
>> Thou shalt not assign pointer values to chars.
>>
>> *test = 0;
>> test[0] = 0;
>>
>>or any of several synonymous statements will do.
>>
>
>
> I used test as string buffer. After strcat to test buffer in this process, i
> will need to clear the buffer,
No, you don't. You just need to mark it with an immediate end-of-string
'\0'.
> and strcat another info to test buffer in
> another process.
For which my above suggestions will work just fine.
- Next message: Magix: "Re: set char to empty"
- Previous message: Magix: "<CR> into string"
- In reply to: Magix: "Re: set char to empty"
- Next in thread: Richard Bos: "Re: set char to empty"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|