*BSD News Article 9032


Return to BSD News archive

Xref: sserve comp.lang.c:36908 comp.unix.bsd:9089
Path: sserve!manuel.anu.edu.au!munnari.oz.au!hp9000.csc.cuhk.hk!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!uunet!spool.mu.edu!umn.edu!news.d.umn.edu!ub.d.umn.edu!not-for-mail
From: cbusch@ub.d.umn.edu (Chris)
Newsgroups: comp.lang.c,comp.unix.bsd
Subject: Segmentation faults
Date: 17 Dec 1992 22:00:22 -0600
Organization: University of Minnesota, Duluth
Lines: 57
Distribution: world
Message-ID: <1gricmINNsl@ub.d.umn.edu>
NNTP-Posting-Host: ub.d.umn.edu




Hi,
    Why is the following code producing a segmentation fault???
I am compiling this code on an Encore Multimax running UMAX 4.3 Unix.
Please send replies to CBUSCH@ub.d.umn.edu.


void cls()
{
   printf("\33[2J");
}

void gotoxy(x,y)
int x,y;
{
   printf("\33[%d;%dH",y,x);
}

void writexy(x,y,s)
{
   printf("\33[%d;%dH%s",y,x,s);
}
   
void start1()
{
   printf("\33[?25l"); /*BTW what does this do with an ANSI terminal?*/
}

void start2()
{
   printf("\33[1;24r"); /*BTW what does this do with an ANSI terminal?*/
}

void end()
{
   printf("\33[?25h"); /*BTW what does this do with an ANSI terminal?*/
}


int main()
{  /*This code is for testing the above for use with terminals*/
   char s[80];
   int x,y;
   start1(); 
  start2();
   do{
      writexy(1,1,"enter x y string:");
      scanf("%d%d%s",&x,&y,s);
      writexy(x,y,s);
   }while(s[0]!='#');


   end();
   return 0; 
}