home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!cs.utexas.edu!torn!watserv1!watmath!undergrad.math.waterloo.edu!bbobak
- From: bbobak@undergrad.math.waterloo.edu (Brad Bobak)
- Subject: Re: I am stumped on this one!!!
- Message-ID: <BryKEp.48y@undergrad.math.waterloo.edu>
- Organization: University of Waterloo
- References: <1992Jul24.204944.18516@cbfsb.cb.att.com> <1992Jul25.165451.21726@infoac.rmi.de>
- Date: Sat, 25 Jul 1992 18:52:00 GMT
- Lines: 33
-
- In article <1992Jul25.165451.21726@infoac.rmi.de>, siebeck@infoac.rmi.de (Wolfgang Siebeck ) writes:
- > 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);
-
- Ooops, a little slip there ;)
-
- >
- >
- > >> strcpy(cp_line, "\0");
- > >> tmp_line = cp_line;
- >
- > -ws
- > --
- > siebeck@infoac.rmi.de (Wolfgang Siebeck)
- >
-
-
-