![]() |
|
|||||||
|
|
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. __________________
The 3 Laws of the Procrastination Society: 1) Never do today that which can be put off until tomorrow 2) Tomorrow never comes |
||||
|
#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 : 14-Sep-2008 at 23: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
R for statistics 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 22:03 |
| Re: Things to Avoid in C/C++ -- scanf / string, Part 7 | WaltP | C Programming Language | 0 | 26-Sep-2005 18:12 |
| Re: Things to Avoid in C/C++ -- scanf, Part 5 | WaltP | C Programming Language | 0 | 20-Sep-2005 19:40 |
| Re: Things to Avoid in C/C++ -- feof(), Part 3 | WaltP | C Programming Language | 0 | 19-Sep-2005 20:00 |
| Re: Things to Avoid in C/C++ -- fflush(stdin), Part 2 | WaltP | C Programming Language | 0 | 17-Sep-2005 20:39 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The