473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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
May 9 '13 #1
1 1380
divideby0
131 128KB
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.
May 9 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jeremy Jones | last post by:
I've written a piece of code that iterates through a list of items and determines the filename to write some piece of data to based on something in the item itself. Here is a small example piece...
6
by: Kiran | last post by:
Hi, I have program, which opens file at the startup and logs error messages to the file, file handle is closed at the end of the program. However if file is deleted in-between, program do not...
4
by: S Borg | last post by:
Hello, If I have a string, what is the strongest way to assure the removal of any line break characters? Line break characters must always be the last character in a line, so would this: ...
4
by: vvenk | last post by:
Hello: I have a string, "Testing_!@#$%^&*()". It may have single and double quotations as well. I would like to strip all chararcters others than a-z, A-Z, 0-9 and the comma. I came across...
1
by: JanaB | last post by:
I am writing a code that needs to read in a binary file. At the moment I don't have to do anything with the data, I just need to view the contents to compare its structure with another binary file....
1
by: =?Utf-8?B?Qw==?= | last post by:
I want to restrict the user entering nonalphanumeric keys using Javascript onKeypress. One exception is that I want to allow the user to enter spaces. How can I do this? Thanks in Advance.
3
Steve Kiss
by: Steve Kiss | last post by:
Hello. I'm developping a website which contains a page to Change A Users Password. In the web.config, I have the following settings for my membership provider: minRequiredPasswordLength="2" ...
3
by: XDeveloper | last post by:
Hi Dear Fellows! I recently have passed Java! And I choose C++ way! So and now I need to understand how can I built below problem! With a binary file operations of addition, removal and...
7
by: Medvedev | last post by:
when i try to read the first byte from an EXE file it's give different results code: FILE *me,*u; char buf_me; char buf_u; me= fopen(argv,"rb"); u= fopen(argv,"rb+");
7
Srijith B
by: Srijith B | last post by:
I am trying to print file information using ffmpeg tool in perl Here is my code use strict; use warnings; use IPC::Open3; # example
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.