Path: utzoo!attcan!uunet!samsung!usc!apple!ksand From: ksand@Apple.COM (Kent Sandvik) Newsgroups: comp.sys.mac.programmer Subject: Re: Str255 in C Message-ID: <48035@apple.Apple.COM> Date: 13 Jan 91 22:23:41 GMT References: <1991Jan13.210327.9613@ux1.cso.uiuc.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 33 In article <1991Jan13.210327.9613@ux1.cso.uiuc.edu> ml27192@uxa.cso.uiuc.edu (lanett mark) writes: >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."; >> } > > >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_. A strcpy(s,"\pThis wirl work."); eliminates the CtoPstr call as well. Regards, Kent Sandvik -- Kent Sandvik, Apple Computer Inc, Developer Technical Support NET:ksand@apple.com, AppleLink: KSAND DISCLAIMER: Private mumbo-jumbo Zippy++ says: "The ANSI C++ Standard should be an object oriented model"