i posted a thread earlier and from the links given to me there i found that scanf(), gets() and some functions in C cause a lot of problem when an erroneous input is given....
1. i want to know how these problems are avoided while programming
2. if these functions are this troublesome then what function is actually used to input data in places where security is a big concern..
3. can someone please give me a sample code for inputting string, character, integer and floating point numbers without these problems...
aasi007onfire
0
Newbie Poster
Recommended Answers
Jump to PostUse fgets() to read a line of input into a buffer, and check the result.
Use strchr() to step from one delimiter to the next for example.
Use strncpy() to copy string fragments, and make sure that a \0 is appended. Write your own version of strncpy() which …
All 3 Replies
Salem
5,138
Posting Sage
iamthwee
commented:
excellent summary
+11
Aia
commented:
Nice
+5
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
praneeth_gunda
2
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.