Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
gets() - dangerous?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Flash Gordon, post: 2443242"] Yes, it take absolutely no run time at all because it fails to compile. No such header in standard C, and it does not exist on all of the implementations I use including one very popular platform. What if the buffer is larger than INT_MAX? Wouldn't size_t be more appropriate for the size? See comments above. Oh dear, I passed in a string longer than INT_MAX. The above comment is rather daft. By *definition* strlen does not include the null termination in the length of the string. Therefore you would need to be using something other than a C compiler to not need the +1. Non-standard function that does not exist on at least one very popular platform. Why don't you use memmove which *does* exist because it is part of the C standard? However it will fail if either the size of the source string (including null termination) or the size of the destination buffer is larger than can be represented in a string. Rather inconsistent with the functions in the standard C library. No, because it uses bcopy it is not portable and won't even compile on some significant platforms. If fixed so that it actually worked those would be good points. In future, please post standard C answers not implementation specifics, especially when there is a simple standard C way of doing the same thing. We only deal with standard C here, not the BSD extensions, POSIX extensions or Windows extensions. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
gets() - dangerous?
Top