Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!mimsy!mojo!russotto From: russotto@eng.umd.edu (Matthew T. Russotto) Newsgroups: comp.sys.mac.programmer Subject: Re: Quick Question - Strings Message-ID: <1990Dec13.183037.655@eng.umd.edu> Date: 13 Dec 90 18:30:37 GMT References: <32027.276537C6@stjhmc.fidonet.org> <90347.101213CXT105@psuvm.psu.edu> Sender: news@eng.umd.edu (C-News) Organization: College of Engineering, Maryversity of Uniland, College Park Lines: 17 In article <90347.101213CXT105@psuvm.psu.edu> CXT105@psuvm.psu.edu (Christopher Tate) writes: >Careful here: remember, the Mac expects to see Pascal-style strings most of >the time (for example, when using DrawString() to write them into a window) >instead of C-style strings. So, you might have to do something like > > strcpy(test, "\pHello"); /* \p indicates a Pascal string */ NONONONONONONONONO! "A string beginning with "\p" or "\P" is a Pascal string. It is not terminated with a null byte". That strcpy can copy tons of characters and write all over memory. Try strncpy(test, "\pHello", 6); -- Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu .sig under construction, like the rest of this campus.