Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker!apple!motcsd!dms!rotberg From: rotberg@dms.UUCP (Ed Rotberg) Newsgroups: comp.sys.mac.programmer Subject: Re: Quick ThinkC String question... Message-ID: <985@dms.UUCP> Date: 14 Feb 90 17:17:47 GMT References: <77108@tut.cis.ohio-state.edu> Distribution: usa Organization: Atari Games Inc., Milpitas, CA Lines: 35 From article <77108@tut.cis.ohio-state.edu>, by waylonis@banana.cis.ohio-state.edu (Mr Waylonis): > Hi, > > I'm having a problem getting ThinkC to accept the following: > > procedureX() > { > Str255 myString; > > myString = "\pExample string"; > } > > Any suggestions? Offhand, I can't say whether the above syntax is legal or not as I'm more of a "working man's" C programmer, and not a theoretician. However, as the compiler dosn't like it, you need to write a small routine like: void pStrcpy(dst,src) /* I myself like (src,dst) but it's just not C!! */ Str255 *dst,*src; { int i; for(i = (unsigned char)(*src); i >=0; --i) /* cast whenever in doubt */ *dst++ = *src++; } Then myString = "\pExample string"; becomes pStrcpy(myString,"\pExample string"); Not precisely elegant, but it'll work. - Ed Rotberg -