Welcome to Dream.In.Code
Become a C++ Expert!

Join 150,019 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,497 people online right now. Registration is fast and FREE... Join Now!




input overload in "C"

 
Reply to this topicStart new topic

input overload in "C", how do you stop it?

Lachine
3 Dec, 2006 - 06:16 AM
Post #1

New D.I.C Head
*

Joined: 3 Dec, 2006
Posts: 1


My Contributions
as part of my assignment were having out programs tested like mad, I know one of the tests is to see if they can overload scanf by pressing and leaving their fingers on a button for 2 mins and watching it crash.

Im pretty sure the way around it involves the "get or fget" functions, but I have no clue as to how/where to use it, as any resources on the net are far to complex for me to understand.

heres a sample clip from my program, theres about 20-25 input sections in total.

CODE
do
       {                                
                system("cls");                                  
                printf("\n\nPlease select the spot frequency in Hz : ");
                scanf("%s",bufferfreq);
                freq = (float)atof(bufferfreq);    
       }
                while (freq <= 0 || freq >= 1000000001);


Thank you
User is offlineProfile CardPM
+Quote Post

y0da
RE: Input Overload In "C"
4 Dec, 2006 - 10:05 AM
Post #2

D.I.C Head
Group Icon

Joined: 8 Nov, 2006
Posts: 62


Dream Kudos: 75
My Contributions
I had a problem with that in one of the books I was reading.... All I did was set a loop and adjusted the buffer overload. Told it when the loop completes just to go back to the begining of the loop and start over with what you had before the loop started... I think I explained that right....
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/8/09 09:14PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month