Thread: Using fgets()

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    25

    Using fgets()

    How do I use fgets()? what is the syntax?
    Remember, if at first you don't succeed, destroy all evidence that you tried in the first place.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Code:
    if ( fgets ( buffer, size, stream ) != NULL ) {
      /* Good */
    }
    else {
      /* EOF or error */
    }
    My best code is written with the delete key.

  3. #3
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    http://unixhelp.ed.ac.uk/CGI/man-cgi?fgets+3

    Google is your friend!

    Next time STFW
    If you understand what you're doing, you're not learning anything.

  4. #4
    Registered User
    Join Date
    Oct 2005
    Posts
    38
    look it up in a book! or search the internet or the faq board on this site.
    You didn't even try looking on your own first did you?

    http://msdn.microsoft.com/library/de...scmafgetws.asp

    there is a link to the msdn documentation for fgets....that shows you how to use it. Next time don't be so lazy.

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >You didn't even try looking on your own first did you?
    >Next time don't be so lazy.
    Not to sound rude, even though I am and have the full intention of doing so. But it's generally accepted practice to wait until you've gotten enough posts to earn a good reputation as someone who knows what he's doing before getting an attitude. You'll fare better with the mods if they like you, and you won't be seen as a troll by everyone else.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fgets not working after fgetc
    By 1978Corvette in forum C Programming
    Replies: 3
    Last Post: 01-22-2006, 06:33 PM
  2. problem with fgets
    By learninC in forum C Programming
    Replies: 3
    Last Post: 05-19-2005, 08:10 AM
  3. problem with fgets
    By Smoot in forum C Programming
    Replies: 4
    Last Post: 12-07-2003, 03:35 AM
  4. fgets crashing my program
    By EvBladeRunnervE in forum C++ Programming
    Replies: 7
    Last Post: 08-11-2003, 12:08 PM
  5. help with fgets
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 10-17-2001, 08:18 PM