home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!Sirius.dfn.de!Urmel.Informatik.RWTH-Aachen.DE!infoac!siebeck
- From: siebeck@infoac.rmi.de (Wolfgang Siebeck )
- Subject: Re: I am stumped on this one!!!
- Message-ID: <1992Jul25.165451.21726@infoac.rmi.de>
- Organization: RMI Net INFO.box Systems * Aachen * Hamburg * Flensburg
- References: <1992Jul24.204944.18516@cbfsb.cb.att.com> <Brx394.4qL@undergrad.math.waterloo.edu>
- Date: Sat, 25 Jul 1992 16:54:51 GMT
- Lines: 27
-
- bbobak@undergrad.math.waterloo.edu (Brad Bobak) writes:
-
- >In article <1992Jul24.204944.18516@cbfsb.cb.att.com> rajeev@cbnewsf.cb.att.com (rajeev.dolas) writes:
- >>
- >>Hello all,
- >>
- >> pbuf = pars_wbuf;
- >> 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));
-
- or better:
-
- cp_line = (char*)malloc(strlen(pars_wbuf) + 1);
-
-
- >> strcpy(cp_line, "\0");
- >> tmp_line = cp_line;
-
- -ws
- --
- siebeck@infoac.rmi.de (Wolfgang Siebeck)
-
-