Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!ucsd!nosc!helios.ee.lbl.gov!ux1.lbl.gov!beard From: beard@ux1.lbl.gov (Patrick C Beard) Newsgroups: comp.sys.mac.programmer Subject: Re: sprintf problems under LSC 2.15 Summary: XCMD's & XFCN's under LSC cannot have globals! Message-ID: <805@helios.ee.lbl.gov> Date: 22 Aug 88 17:36:19 GMT References: <4562@saturn.ucsc.edu> Sender: usenet@helios.ee.lbl.gov Reply-To: beard@ux1.lbl.gov (Patrick C Beard) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 16 In article <4562@saturn.ucsc.edu> sirkm@ssyx.ucsc.edu (Greg Anderson) writes: >I am working on a HyperCard XFCN using LSC 2.15. The statement >strcpy(CStr,"junk"); works, but sprintf(CStr,"junk"); causes the >XFCN to crash. Is the printf library of LSC incompatible with >HyperCard, or am I missing some libraries? I'm linking with strings, >sprintf/sscanf, MacTraps and XCmdGlue.c. The problem is with the way sprintf and the whole printf library is written. This got me down a while back, too. The functions all work by setting certain global variables and calling a core group of functions to do the formatting. Under LSC 2.15, you can't have global variables in code resources (I don't think you can even under 3.0 except for drivers and DA's) and so something strange is happening when you call sprintf. Patrick Beard LBL, beard@ux1.lbl.gov