Thread: reading words line by line from a file

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    569

    reading words line by line from a file

    I am using fgets to read words line by line, however using fgets I always get the extra '\n' in each line.. how do I eliminate it?

    say I have this list:

    Apple
    Bubble
    Man
    Zebra

    then I use fgets, I get Apple\n, how do I get Apple only?
    Last edited by -EquinoX-; 05-03-2008 at 11:58 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading text file by line number
    By whiskedaway in forum C++ Programming
    Replies: 13
    Last Post: 06-16-2009, 10:09 AM
  2. help again with scrolling without wrapping
    By Dukefrukem in forum C Programming
    Replies: 8
    Last Post: 09-21-2007, 12:48 PM
  3. I'm not THAT good am I?
    By indigo0086 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 10-19-2006, 10:08 AM
  4. Program crashes on reading a line from a file
    By bluescreen in forum C Programming
    Replies: 5
    Last Post: 10-19-2006, 05:23 AM
  5. reading a text file printing line number
    By bazzano in forum C Programming
    Replies: 4
    Last Post: 09-16-2005, 10:31 AM