![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
||||
|
||||
Re: Things to Avoid in C/C++ -- scanf / epilogue, Part 9I just posted a GID Community blog entitled: Things to Avoid in C/C++ -- scanf / epilogue, Part 9.
Quote:
Please let me know what you think. This is an auto-generated message posted by GIDNetwork™ on behalf of the author. __________________
During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence? |
||||
|
#2
|
|||
|
|||
Re: Things to Avoid in C/C++ -- scanf / epilogue, Part 9Quote:
In the last example, I see this: CPP / C++ / C Code:
Best rgds, --Geert Last edited by admin : 15-Sep-2008 at 00:30.
Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
|
|
#3
|
|||
|
|||
Re: Things to Avoid in C/C++ -- scanf / epilogue, Part 9Quote:
http://www.asciitable.com/ ...you will see that characters below 0x20 are considered non-printable, & 0x7f represents the upper boundary. Given that the code uses a do-while loop, the loop will repeat while the condition is true. In other words, as if the character read is not printable or above DEL, get another character. If the character read is a printable character, exit the loop & return the character as the return value of the function. Basically, the function ensures that the keypress received as input is a printable ("good") character. If it is not, then repeat ad infinitum until a printable character is received. You can always compile the code yourself in a test application to verify its behaviour. |
|
#4
|
|||
|
|||
Re: Things to Avoid in C/C++ -- scanf / epilogue, Part 9Quote:
You're right. I completely missed the way the do-while construction has been made... Best rgds, --Geert |
Recent GIDBlog
Once again, no time for hobbies by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: Things to Avoid in C/C++ -- scanf / number, Part 8 | WaltP | C Programming Language | 0 | 27-Sep-2005 23:03 |
| Re: Things to Avoid in C/C++ -- scanf / string, Part 7 | WaltP | C Programming Language | 0 | 26-Sep-2005 19:12 |
| Re: Things to Avoid in C/C++ -- scanf, Part 5 | WaltP | C Programming Language | 0 | 20-Sep-2005 20:40 |
| Re: Things to Avoid in C/C++ -- feof(), Part 3 | WaltP | C Programming Language | 0 | 19-Sep-2005 21:00 |
| Re: Things to Avoid in C/C++ -- fflush(stdin), Part 2 | WaltP | C Programming Language | 0 | 17-Sep-2005 21:39 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The