Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!bin From: bin@primate.wisc.edu (Brain in Neutral) Newsgroups: comp.sys.mac.programmer Subject: Re: Str255 Message-ID: <3869@uakari.primate.wisc.edu> Date: 31 Jan 91 07:29:58 GMT References: <1991Jan31.061259.20093@ux1.cso.uiuc.edu> Sender: bin@primate.wisc.edu Reply-To: bin@primate.wisc.edu Lines: 27 From article <1991Jan31.061259.20093@ux1.cso.uiuc.edu>, by dmmg1176@uxa.cso.uiuc.edu (David M Marcovitz): | | I am using Think C 4.0 with TCL. I am trying to use the gBartender | class to change menus. On page 246 of the manual, it gives an | example: | | gBartender->SetCmdText(cmdCopy, "\pCopy Picture"); | | The second argument is supposed to be a Str255. If I use the command | just like this, the compiler doesn't recognize the second argument as | being the right type. | | (2) Is there a way to do this without declaring a variable? How about: gBartender->SetCmdText(cmdCopy, (StringPtr) "\pCopy Picture"); The disparity comes about because literal "...." constructs are considered char arrays, whereas Str255 are array of unsigned chars. This is really a pain, but necessary, because otherwise operations using the length byte of Str255 variables are dangerous in that you can get sign-extension if the length of the string is > 127. -- Paul DuBois dubois@primate.wisc.edu