home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!bu.edu!dartvax!Roger.W.Brown
- From: Roger.W.Brown@dartmouth.edu (Roger W. Brown)
- Newsgroups: comp.sys.mac.hypercard
- Subject: Re: Setting a global variable in HC from an XCMD
- Message-ID: <1992Sep3.190112.18947@dartvax.dartmouth.edu>
- Date: 3 Sep 92 19:01:12 GMT
- References: <1992Sep2.232806.16399@nntp.uoregon.edu>
- Sender: news@dartvax.dartmouth.edu (The News Manager)
- Organization: Dartmouth College, Hanover, NH
- Lines: 30
- X-Posted-From: InterNews1.0a4@newshost.dartmouth.edu
-
- In article <1992Sep2.232806.16399@nntp.uoregon.edu>
- eric_gorr@coglab_psych.uoregon.edu (Eric Gorr) writes:
-
- > Can someone please provide me with some sample code that will accomplish
- > this?
-
-
- Something like this (This is not an actual example, but it's close):
- The name of the global here is "MyGlobal". We put a string into it.
-
- Handle h;
- char s[256];
- long len;
-
- strcpy(s,"some stuff");
- len = (long)strlen(s) + 1;
- h = NewHandle(len);
- if (h==NULL) {
- DebugStr("\pOut of memory');
- return;
- }
- BlockMove(s,*h,len);
- SetGlobal(gParamPtr,"\pMyGlobal",h);
- DisposHandle(h);
-
- No guarantees, but your compiler will help you if I made a mistake.
- --------------------------------------------------------------------
- Roger Brown roger.brown@dartmouth.edu
- Software Development
- Kiewit Computation Center, Dartmouth College, Hanover, NH
-