🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #138

Re: I am stumped on this one!!!

#138
From: rajeev.dolas
Date: Mon, 27 Jul 1992 13:53
26 lines
1423 bytes
In article <13744@auspex-gw.auspex.com> guy@Auspex.COM (Guy Harris) writes:
>>>		cp_line = (char *)malloc(sizeof(strlen(pars_wbuf)));
>>
>> You're allocing the sizeof an int, which is likely four bytes.
>> You also forgot to alloc space for the '\0'. Try it again with:
>>
>>	cp_line = (char*)malloc(sizeof(strlen(pars_wbuf) + 1));
>
>No, try it again with:
>
>>	cp_line = (char*)malloc(strlen(pars_wbuf) + 1);
>
>because, as you noted, the "sizeof" doesn't belong there - it turns the
>argument into the size of the result of "strlen", which isn't the length
>of the string.
>
>(Also, try not leaving every single line of the original posting in your
>followup; it makes it rather hard to find the stuff that *doesn't* come
>from the original posting....)

I did modify my code and removed the sizeof(), but that does not help.
As I mentioned previously, the error is in fputs() or putc().

Thanks.

Raj Dolas
Technical Details
Message-ID: <1992Jul27.135350.5772@cbfsb.cb.att.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!walter!att!cbfsb!cbnewsf.cb.att.com!rajeev
References: <1992Jul24.204944.18516@cbfsb.cb.att.com> <Brx394.4qL@undergrad.math.waterloo.edu> <13744@auspex-gw.auspex.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!walter!att!cbfsb!cbnewsf.cb.att.com!rajeev
From: rajeev@cbnewsf.cb.att.com (rajeev.dolas)
Subject: Re: I am stumped on this one!!!
Message-ID: <1992Jul27.135350.5772@cbfsb.cb.att.com>
Sender: news@cbfsb.cb.att.com
Organization: AT&T
References: <1992Jul24.204944.18516@cbfsb.cb.att.com> <Brx394.4qL@undergrad.math.waterloo.edu> <13744@auspex-gw.auspex.com>
Distribution: usa
Date: Mon, 27 Jul 1992 13:53:50 GMT
Lines: 28