Re: REMINDER: Do not use your real email adddress
From: Baho Utot (baho-utot_at_philippines-island.org)
Date: 09/25/03
- Next message: Baho Utot: "Re: REMINDER: Do not use your real email adddress"
- Previous message: marius: "USB Modem Driver for Linux"
- In reply to: Mark A. Odell: "Re: REMINDER: Do not use your real email adddress"
- Next in thread: Joe Beanfish: "Re: REMINDER: Do not use your real email adddress"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 25 Sep 2003 20:00:40 GMT
Mark A. Odell wrote:
>
>
> Joe Beanfish <joebeanfish@nospam.duh> wrote in
> news:3F73226C.CACAD4B6@nospam.duh:
>
>> No. fgets() returns a pointer, not a char or int.
>> Comparing it to '\0' will work in many circumstances
>> if the compiler doesn't reject it, but it's not a good idea.
>> It should be
>>
>> if(fgets(email, E_BUFFER, stdin) == NULL) {
>
> C's notion of a boolean is guaranteed to work just as well I believe. E.g.
>
> if(!fgets(email, E_BUFFER, stdin))
>
Yes, I concur. But if your really paranoid then
if((char*)0 == fgets(email, E_BUFFER, stdin)) {
.......... some code
}
I always test as above because if you have a brain fart and do:
if((char*)0 = fgets(email, E_BUFFER, stdin)) {
.......... some code
}
Then the compiler will complain you can not assign to a constant (or
something like that, I don't recall exactly).
Later Dudes
- Next message: Baho Utot: "Re: REMINDER: Do not use your real email adddress"
- Previous message: marius: "USB Modem Driver for Linux"
- In reply to: Mark A. Odell: "Re: REMINDER: Do not use your real email adddress"
- Next in thread: Joe Beanfish: "Re: REMINDER: Do not use your real email adddress"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|