Path: utzoo!attcan!uunet!wuarchive!julius.cs.uiuc.edu!ux1.cso.uiuc.edu!uxa.cso.uiuc.edu!ml27192 From: ml27192@uxa.cso.uiuc.edu (lanett mark) Newsgroups: comp.sys.mac.programmer Subject: Re: Str255 in C Message-ID: <1991Jan13.210327.9613@ux1.cso.uiuc.edu> Date: 13 Jan 91 21:03:27 GMT References: Sender: news@ux1.cso.uiuc.edu (News) Organization: University of Illinois at Urbana Lines: 30 jeffb@cs.fau.edu (Jeffrey Boser) writes: >this might seem like a stupid question, but it has been stumping me for >some time: >how do I assign a string constant to a variable of type Str255? >ie: > { > Str255 s; > s = "\pThis wont work."; > } >.....Jeff In C the name of an array is actually a pointer to it, so if you _did_ assign "names" you would really only be assigning the pointer (i.e. a=b will make a and b both point to b, while real string a is lost). Use strcpy (in ): strcpy (a, "This is a string"); I'm not sure doing this with a p-str will work, since it may not have the requisite 0-byte at the end of the string. Try strcpy (s, "This will work."); CToPStr (s); (spelling may be wrong) CToPStr converts the string _in place_. Mark Lanett