Path: utzoo!attcan!uunet!husc6!bloom-beacon!ATHENA.MIT.EDU!swick From: swick@ATHENA.MIT.EDU (Ralph R. Swick) Newsgroups: comp.windows.x Subject: Re: Widget writing: XtGetValues() Message-ID: <8808051648.AA06425@LYRE.MIT.EDU> Date: 5 Aug 88 16:47:58 GMT References: <4859@pasteur.Berkeley.EDU> Sender: daemon@bloom-beacon.MIT.EDU Organization: DEC/MIT Project Athena Lines: 25 I have to infer a lot from your description of your problem, as it's not clear to me whether you are using an existing widget (which may have bugs) or writing your own widget. I suspect the problem you are having is one that has confused many people. Resources of representation type XtRString are typedef'd as String; that is, char*. Thus the value of the resource is the pointer, not the contents of the string. When you do an XtGetValues, you'll get the pointer; no copying is done. So you really want something like: Arg arg; char *buf; XtSetArg(arg, XtNstring, &buf); XtGetValues(widget, &arg, ONE); So your diagnosis of the problem was correct. I can't guess why you may be having similar problems with other widget resources, without knowing the widgets involved. It is a common error to forget that XtGetValues requires the arglist to contain pointer(s) to the destination(s); the returned values are not stored into the arglist directly. If you happen to be using Xaw(AsciiString), then you're going to lose anyway, as GetValues(XtNstring) is broken in that widget.