![]() |
||||
|
|
||||
|
||||
| « Things to Avoid in C/C++ -- scanf / character, Part 6 | Things to Avoid in C/C++ -- scanf / number, Part 8 » |
Things to Avoid in C/C++ -- scanf / string, Part 7
by: WaltP - Sep 26, 2005
scanf() / Reading a stringThere is only one thing I really need to say about using scanf() to read a character string: Read this about gets() and replace with scanf("%s", ...). scanf() and gets() have the exact same problem with memory overrun. You can easily read in more characters than your char* can hold. And of course, scanf() has The Steps, too. The solutions are the same. 'Nuff said. Coming next, scanf() / Reading numbers.
|
GIDNetwork Sites
Archives
Contact Us
|
| « Things to Avoid in C/C++ -- scanf / character, Part 6 | Things to Avoid in C/C++ -- scanf / number, Part 8 » |