| | |
C Function
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2009
Posts: 3
Reputation:
Solved Threads: 0
Hello,
Out of fgets() and gets() which function is safe to use and why?
Thanks
Out of fgets() and gets() which function is safe to use and why?
Thanks
•
•
Join Date: Nov 2008
Posts: 90
Reputation:
Solved Threads: 8
•
•
•
•
Hello,
Out of fgets() and gets() which function is safe to use and why?
Thanks
fgets reads characters from stream into the string s. It stops when it reads either n - 1 characters or a newline character, whichever comes first.
gets collects a string of characters terminated by a new line from the
standard input stream stdin and puts it into s.
gets() is NEVER safe to use because it can corrupt the memory of your program and cause it to crash (or coredump in *nix). Read this explaination.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- Need help on a program (function bug) (C)
- Assign content to a function pointer (C)
- PHP Feezing with a function (PHP)
- ASP Replace Function.... (ASP)
- missing function header (C++)
- Function that returns void (C++)
Other Threads in the C Forum
- Previous Thread: compiler error when address of a pointer is passed
- Next Thread: Network Programming Questions
| Thread Tools | Search this Thread |
Tag cloud for C
#include * append array arrays asterisks binarysearch calculate changingto char character cm command copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic execv feet fgets file fork forloop framework function functions givemetehcodez grade graphics gtkwinlinux hacking histogram homework include incrementoperators input intmain() iso kernel keyboard km lazy license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix microsoft motherboard mqqueue number oddnumber odf opensource overwrite owf pdf performance pointer posix problem probleminc process program programming radix recursion recv recvblocked research reversing scanf scripting segmentationfault sequential socket socketprograming spoonfeeding standard string student systemcall testing threads turboc unix user variable wab whythiscodecausesegmentationfault windowsapi






