Dave’s Brain
Home
Search
Browse
Recent
Keywords
Other sites
Feedback
Sign in
Random
Crawlers
Programming Tips
- C/C++: gets() isn't safe - here's a replacement
Date:
2000jun14
Language:
C/C++
Q.
C/C++: gets() isn't safe - here's a replacement
A.
Instead of
char
buf
[
1000
];
gets
(
buf
);
// No bounds checking
do
fgets
(
buf
,
sizeof
(
buf
),
stdin
);