Thread: Word sorting

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    3

    Word sorting

    Hi, i need help with a couple of functions.

    I've got a text file with a list of words

    Eg.
    and ant any ape apt arc are ark arm art ash ask asp ass ate ave awe awl awn

    What i need to do is remove the white space & replace each word on a newline,

    Eg.
    and
    ant
    any
    ape
    apt
    Etc......

    I have no real idea of how to accomplish this task.

    Can anyone think of a function to do this?



    TIA

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Code:
    if ( ch == ' ' ) ch = '\n';
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Word frequency and sorting
    By zyxx_66 in forum C Programming
    Replies: 32
    Last Post: 12-17-2008, 02:30 AM
  2. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  3. please help with binary tree, urgent.
    By slickestting in forum C Programming
    Replies: 2
    Last Post: 07-22-2007, 07:55 PM
  4. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  5. Wrong Output
    By egomaster69 in forum C Programming
    Replies: 7
    Last Post: 01-28-2005, 06:44 PM