home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / c / 18586 < prev    next >
Encoding:
Text File  |  1992-12-20  |  1.3 KB  |  70 lines

  1. Xref: sparky comp.lang.c:18586 comp.unix.bsd:10347
  2. Path: sparky!uunet!spool.mu.edu!umn.edu!news.d.umn.edu!ub.d.umn.edu!not-for-mail
  3. From: cbusch@ub.d.umn.edu (Chris)
  4. Newsgroups: comp.lang.c,comp.unix.bsd
  5. Subject: Segmentation faults
  6. Date: 17 Dec 1992 22:00:22 -0600
  7. Organization: University of Minnesota, Duluth
  8. Lines: 57
  9. Distribution: world
  10. Message-ID: <1gricmINNsl@ub.d.umn.edu>
  11. NNTP-Posting-Host: ub.d.umn.edu
  12.  
  13.  
  14.  
  15.  
  16. Hi,
  17.     Why is the following code producing a segmentation fault???
  18. I am compiling this code on an Encore Multimax running UMAX 4.3 Unix.
  19. Please send replies to CBUSCH@ub.d.umn.edu.
  20.  
  21.  
  22. void cls()
  23. {
  24.    printf("\33[2J");
  25. }
  26.  
  27. void gotoxy(x,y)
  28. int x,y;
  29. {
  30.    printf("\33[%d;%dH",y,x);
  31. }
  32.  
  33. void writexy(x,y,s)
  34. {
  35.    printf("\33[%d;%dH%s",y,x,s);
  36. }
  37.    
  38. void start1()
  39. {
  40.    printf("\33[?25l"); /*BTW what does this do with an ANSI terminal?*/
  41. }
  42.  
  43. void start2()
  44. {
  45.    printf("\33[1;24r"); /*BTW what does this do with an ANSI terminal?*/
  46. }
  47.  
  48. void end()
  49. {
  50.    printf("\33[?25h"); /*BTW what does this do with an ANSI terminal?*/
  51. }
  52.  
  53.  
  54. int main()
  55. {  /*This code is for testing the above for use with terminals*/
  56.    char s[80];
  57.    int x,y;
  58.    start1(); 
  59.   start2();
  60.    do{
  61.       writexy(1,1,"enter x y string:");
  62.       scanf("%d%d%s",&x,&y,s);
  63.       writexy(x,y,s);
  64.    }while(s[0]!='#');
  65.  
  66.  
  67.    end();
  68.    return 0; 
  69. }   
  70.