Ignoring the Spacebar

This is a discussion on Ignoring the Spacebar within the C++ Programming forums, part of the General Programming Boards category; Hi all, I want to get characters from a disk file and storing them in an array of characters.But i ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,659
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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: How to take a string input and remove 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, 12: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21