Thread: Keeping only A-Z . , in a text file

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    1

    Keeping only A-Z . , in a text file

    Hi, im wanting to no, what is needed to remove all characters like £ $ from a text file, to leave only normal letters remaining? Thanks.

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    read file (for example usinf fgetc)
    check char - using isupper, or isalpha or other suitable function
    write char to the new file if it is ok
    delete the old file and rename the new file

    if file is not too big:
    read file (for example usinf fgetc)
    check char - using isupper, or isalpha or other suitable function
    add it to the buffer if condition passed

    when the whole file is processed - overwrite it with the buffer prepared
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  2. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  3. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM
  4. checking values in a text file
    By darfader in forum C Programming
    Replies: 2
    Last Post: 09-24-2003, 02:13 AM
  5. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM