home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / msdos / programm / 11468 < prev    next >
Encoding:
Internet Message Format  |  1992-12-17  |  2.0 KB

  1. Xref: sparky comp.os.msdos.programmer:11468 comp.lang.c++:18115
  2. Newsgroups: comp.os.msdos.programmer,comp.lang.c++
  3. Path: sparky!uunet!mnemosyne.cs.du.edu!nyx!slindsay
  4. From: slindsay@nyx.cs.du.edu (Steve Lindsay)
  5. Subject: fgets
  6. Message-ID: <1992Dec17.060608.18196@mnemosyne.cs.du.edu>
  7. Sender: usenet@mnemosyne.cs.du.edu (netnews admin account)
  8. Organization: Nyx, Public Access Unix @ U. of Denver Math/CS dept.
  9. Distribution: na
  10. Date: Thu, 17 Dec 92 06:06:08 GMT
  11. Lines: 44
  12.  
  13.  
  14. I have been posting a lot of stupid questions lately
  15. as I have been programming only for 2 1/2 weeks. 
  16. So here is probably another one.
  17.  
  18. I am using fgets for the user to enter some numbers.
  19. It works fine except if a person holds down the ESC 
  20. key (trying to make it screw up) it will scroll my whole
  21. graphics screen off the screen.  How do you keep it
  22. from doing that?     I am using DOS VGA <graphics.h>
  23. and Borland C++ 3.1. Thanks for any help!!
  24.  
  25. PS   I hope this isn't another one of those silly questions
  26. I ask.  They don't seem so silly when I ask them,
  27. but when you wizards answer them I would like to
  28. crawl under the table.  That's whats so great about this
  29. internet no one knows me........right.
  30.  
  31. **********HERE IS THE ROUTINE***************
  32.  
  33. if (position==6)
  34.     { settextjustify( CENTER_TEXT, CENTER_TEXT );
  35.     x=147,y=350;
  36.     gprintf(&x,&y,"Enter new");
  37.     gprintf(&x,&y,"Balance position of point");
  38.     gotoxy(18,25);
  39.     fflush(stdin);   //flush it, just in case something else is in it
  40.     fgets (s,10,stdin); //get string, only 9 characters(from the stdin)
  41.     fflush(stdin);
  42.                             //if s(the string) is a number, convert 
  43.     if ( f=atof (s) )   //it to a floating point and store it in f.
  44.        {balanceofpoint=f;    
  45.        setfillstyle (1, BLUE);
  46.        bar (300,403, 355,413);
  47.        settextjustify( RIGHT_TEXT, CENTER_TEXT );
  48.        x=355,y=408;
  49.        gprintf(&x,&y,"%.3f",balanceofpoint);
  50.        setfillstyle (1, BLUE);
  51.        bar (25,325, 270,425); }
  52.    else
  53.       {setfillstyle (1, BLUE);
  54.       bar (25,325, 270,425); }}
  55.    }
  56.  
  57.