Thread: Ignoring the Spacebar

  1. #1
    Registered User
    Join Date
    Jun 2007
    Location
    Qatar
    Posts
    39

    Cool Ignoring the Spacebar

    Hi all,
    I want to get characters from a disk file and storing them in an array of characters.But i do not want to add Spaces in the array.Wat shuold i do now.Because spaces are being stored as a character in the array.

  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
    Read one character at a time, then use an if statement to choose whether to store it in your variable.
    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.

  3. #3
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Consider searching the forums ,
    Several posts demonstrating Salem's method: http://cboard.cprogramming.com/showt...ore+whitespace

  4. #4
    Registered User
    Join Date
    Jun 2007
    Location
    Qatar
    Posts
    39
    Thanxxx Salem,zacs
    i am going to try this one

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 04-03-2009, 04:16 PM
  2. Sort a string vector ignoring case
    By jw232 in forum C++ Programming
    Replies: 6
    Last Post: 02-01-2008, 01:37 AM
  3. spacebar problem?
    By limitmaster in forum Tech Board
    Replies: 2
    Last Post: 07-17-2006, 07:07 AM
  4. Pressed Spacebar
    By smonk in forum Windows Programming
    Replies: 4
    Last Post: 08-02-2005, 04:07 PM
  5. Ignoring the Tab at the begining of the line..
    By NANO in forum C++ Programming
    Replies: 8
    Last Post: 05-03-2003, 10:56 PM