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