Article View: comp.os.os2.programmer
Article #3007Re: sprintf() hangs application (*more info*)
From: Larry Salomon Jr.
Date: Tue, 17 Nov 1992 20:08
Date: Tue, 17 Nov 1992 20:08
35 lines
1902 bytes
1902 bytes
In <1992Nov17.190901.16350@panix.com> I write: >For some reason, a call to sprintf() instead one of my routines >(called getTempName()) hangs my PM application (using C-Set/2 from >CD ROM to compile). >Since sprintf() calls malloc() I decided to allocate 100 bytes before >calling sprintf() (and immediately free the 100 bytes), and - sure enough - >the app hung on the malloc() call. >It sounds like something is getting trashed somewhere, but I don't make >any calls to malloc() (I use my own home-grown routines, which I am 99% >sure are correct) so it's not like the run-time is suffering from memory >fragmentation. Since then, I've changed the call to getTempName() to sprintf(achFile,"MSR%05d",0) and then to sprintf(achFile,"MSR%5d",0) and then to sprintf(achFile,"MSR00000") and finally to strcpy(achFile,"MSR00000"). The first three changes resulted in IPMD reporting an access violation, while the last call simply hung the app again. I'm having trouble opening an annotated listing in IPMD so I can't verify the code that is being generated. My compiler options are: -C+ -Gd- -Ge+ -Gm+ -Ms -O- -Re -S2 -Sa -Se -Sp -Ss+ -W3 If *anyone* has any ideas, *please* let me know ASAP! Cheers, Q -- "If you choose not to decide, you | "A fool and his money are fun to go still have made a choice" - Rush | out with" - seen on a T-shirt ------------------------------------------------------------------------
Technical Details
Message-ID:
<1992Nov17.200854.18963@panix.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!know!cass.ma02.bull.com!mips2!news.bbn.com!seismo!darwin.sura.net!gatech!rutgers!cmcl2!panix!os2manReferences:
<1992Nov17.190901.16350@panix.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!know!cass.ma02.bull.com!mips2!news.bbn.com!seismo!darwin.sura.net!gatech!rutgers!cmcl2!panix!os2man From: os2man@panix.com (Larry Salomon Jr.) Newsgroups: comp.os.os2.programmer Subject: Re: sprintf() hangs application (*more info*) Message-ID: <1992Nov17.200854.18963@panix.com> Date: 17 Nov 92 20:08:54 GMT References: <1992Nov17.190901.16350@panix.com> Organization: PANIX Public Access Unix, NYC Lines: 35