C: Removal of non-alphanumeric characters from a file.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yuvainetristan
    New Member
    • May 2013
    • 1

    #1

    C: Removal of non-alphanumeric characters from a file.

    The output should also give a file which doesnt consits alphanumeric. I tried this
    while( ( ch = fgetc(fp) ) != EOF ){

    if(isalpha(ch)| |ch==' ')
    Is this correct.than how to complete it.
    Suggest any other method pls
  • divideby0
    New Member
    • May 2012
    • 131

    #2
    you can use isalnum to check whether or not a character is either alpha or numeric. it will return true if a character would be true with either isalpha or isdigit.

    For the file, I'm guessing you are to create an output file? If so, you can use what you've posted provided ch is an integer... you cannot detect EOF using a char data type.

    Comment

    Working...