home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / mac / programm / 19968 < prev    next >
Encoding:
Text File  |  1992-12-17  |  1.5 KB  |  62 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!caen!forfar.uis.itd.umich.edu!Gavin
  3. From: Gavin Eadie <Gavin@UMich.EDU>
  4. Subject: Puzzled: Serial PowerBook I/O
  5. Message-ID: <zzT=-a#@engin.umich.edu>
  6. Date: Thu, 17 Dec 92 08:17:57 EST
  7. Organization: U of Michigan Information Systems
  8. X-Useragent: Nuntius v1.1.1d13
  9. X-Xxmessage-Id: <A755E82D0601BA11@forfar.uis.itd.umich.edu>
  10. X-Xxdate: Thu, 17 Dec 92 13:17:49 GMT
  11. Nntp-Posting-Host: forfar.uis.itd.umich.edu
  12. Lines: 48
  13.  
  14. Friends ... I'm puzzled.  The following complete ThinkC program runs to
  15. completion on several Macs I've tried (II, IIci, Q-700 and Q-900) but
  16. fails to complete on PowerBooks (170 and 145).  It's got to be something
  17. simple (or maybe not) -- can you help?
  18.  
  19.  
  20. #include <Devices.h>
  21. #include <Events.h>
  22. #include <Serial.h>
  23.  
  24. #include <stdIO.h>
  25.  
  26. short     refNum_in, refNum_out;
  27. long    outcount;
  28. char    outBuffer[128];
  29. OSErr    oserr;
  30.  
  31. main () {
  32.     printf("Here we go ... Mouse-Klik to stop\n",oserr);
  33.  
  34.     oserr = OpenDriver("\p.AOut", &refNum_out);
  35.     if(oserr != noErr) {
  36.         printf("OpenDriver(out): %d\n",oserr);
  37.         goto exit;
  38.     }
  39.  
  40.     oserr = OpenDriver("\p.AIn", &refNum_in);
  41.     if(oserr != noErr) {
  42.         printf("OpenDriver(in): %d\n",oserr);
  43.         goto exit;
  44.     }
  45.  
  46.     outcount = 1;
  47.     outBuffer[0] = ' ';
  48.     oserr = FSWrite(refNum_out, &outcount, (Ptr)outBuffer);
  49.     if(oserr != noErr) {
  50.         printf("FSWrite(out): %d\n",oserr);
  51.     }
  52.     
  53. exit:
  54.     do {
  55.     } while (!Button());
  56. }
  57.  
  58.  
  59. +++
  60. Gavin Eadie                   University of Michigan Information Systems
  61. Noise: (313) 936-0816      Internet: gavin@umich.edu      AppleLink: A67
  62.