Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!eecae!netnews.upenn.edu!eniac.seas.upenn.edu!culmer From: culmer@eniac.seas.upenn.edu (Charles Culmer) Newsgroups: comp.sys.apollo Subject: malloc and gpr_$text problem Message-ID: <7888@netnews.upenn.edu> Date: 11 Feb 89 20:12:04 GMT Sender: news@netnews.upenn.edu Reply-To: culmer@eniac.seas.upenn.edu (Charles Culmer) Distribution: na Organization: University of Pennsylvania Lines: 22 I can't get gpr_$text to print character strings that were allocated with sys5 malloc. For example, if I read "Charles" into a statically allocated buffer, allocate space with malloc, copy the input buffer into the new string, and then try to print the text with gpr_$text, I get output that looks like-- space up-arrow space C h a r I'm doing this on a 3000 with version 9.7 sys5. I'm pretty sure the problem isn't a mistake or my ignorance of C and gpr. The same programs work fine if I use printf to print the strings. Moreover, if I statically allocate another text buffer and copy from the dynamically allocated buffer into the statically allocated buffer, gpr_$text prints the string from that buffer just fine. Thanks. Charles W. Culmer culmer@eniac.seas.upenn.edu Truth, justice, and the American way.