home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / hypercar / 3351 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  1.3 KB

  1. Path: sparky!uunet!olivea!bu.edu!dartvax!Roger.W.Brown
  2. From: Roger.W.Brown@dartmouth.edu (Roger W. Brown)
  3. Newsgroups: comp.sys.mac.hypercard
  4. Subject: Re: Setting a global variable in HC from an XCMD
  5. Message-ID: <1992Sep3.190112.18947@dartvax.dartmouth.edu>
  6. Date: 3 Sep 92 19:01:12 GMT
  7. References: <1992Sep2.232806.16399@nntp.uoregon.edu>
  8. Sender: news@dartvax.dartmouth.edu (The News Manager)
  9. Organization: Dartmouth College, Hanover, NH
  10. Lines: 30
  11. X-Posted-From: InterNews1.0a4@newshost.dartmouth.edu
  12.  
  13. In article <1992Sep2.232806.16399@nntp.uoregon.edu>
  14. eric_gorr@coglab_psych.uoregon.edu (Eric Gorr) writes:
  15.  
  16. > Can someone please provide me with some sample code that will accomplish
  17. > this?
  18.  
  19.  
  20. Something like this (This is not an actual example, but it's close):
  21. The name of the global here is "MyGlobal". We put a string into it.
  22.  
  23. Handle h;
  24. char s[256];
  25. long len;
  26.  
  27. strcpy(s,"some stuff");
  28. len = (long)strlen(s) + 1;
  29. h = NewHandle(len);
  30. if (h==NULL) {
  31.       DebugStr("\pOut of memory');
  32.          return;
  33. }
  34. BlockMove(s,*h,len);
  35. SetGlobal(gParamPtr,"\pMyGlobal",h);
  36. DisposHandle(h);
  37.     
  38. No guarantees, but your compiler will help you if I made a mistake.
  39. --------------------------------------------------------------------
  40. Roger Brown                                roger.brown@dartmouth.edu
  41. Software Development
  42. Kiewit Computation Center, Dartmouth College, Hanover, NH
  43.