Using C programming
Compose a program that will read in the provided data file and remove all of the comma characters and replace them with an empty white space character. Your program should output the now cleaned data to a new file with the name n01427232_parsed.txt
Provided Data file
I,Pledge,Allegiance,to,the,flag
of,the,United,States,of,America
and,to,the,Republic
for,which,it,stands,
one,Nation,under,God,
indivisible,
with,liberty,and,justice,for,all.
.
Hi,
Problem has been resolved. Code will ask you to write the file to read then enter the Data file name and it will remove comma and replace comma with while space and copy all the data from 'dat' file to 'n01427232_parsed.txt' file.
The code will read the data from 'file.dat' file or whatever you entered for each char if the char is not comma then it will write to 'txt' file but if it comma then it will replace it with white space.
Result file and running code screenshot has been attached. please refer to the images.
file.dat (Source file)

The destination file (n01427232_parsed.txt) :

Running code screenshot

Code:
----------------------------------
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fle1, *fle2;
char fileNm[100], c;
printf("Enter file to read: \n");
scanf("%s", fileNm);
fle1 = fopen(fileNm, "r");
if (fle1 == NULL)
{
printf("Error while opening file: %s \n", fileNm);
exit(0);
}
fle2 = fopen("n01427232_parsed.txt", "w");
if (fle2 == NULL)
{
printf("Error while opening file: %s \n", fileNm);
exit(0);
}
c = fgetc(fle1);
while (c != EOF)
{
//printf("\n%c \n",c);
if(c!=','){
fputc(c, fle2);
}
else{
fputc(' ', fle2);
}
c = fgetc(fle1);
}
printf("\nCopied task finished \n");
fclose(fle1);
fclose(fle2);
return 0;
}
---------------------------------
The problem has been resolved, I hope you will like the solution. If you have any question or query regarding this problem or other, please comment below and give the positive rating.
Thank You!! Happy Learning!! Keep Chegging!!
Using C programming Compose a program that will read in the provided data file and remove...
Programming in C.
Name this program schwifty.c - This program reads a text file
and makes it schwifty, but the user determines the schwiftiness.
The user supplies the filename to schwift and a string containing a
sequence of the following characters to determine the schwiftiness
via command line arguments:
L - Left shift each character in a word:
hello --> elloh
R - Right shift each character in a word:
elloh --> hello
I - Shift the letters' and digits'...
Write a c++ program in that file to perform a “Search and Replace All” operation. This operation consists of performing a case-sensitive search for all occurrences of an arbitrary sequence of characters within a file and substituting another arbitrary sequence in place of them. Please note: One of the biggest problems some students have with this exercise occurs simply because they don’t read the command line information in the course document titled “Using the Compiler’s IDE”. Your program: 1. must...
C++ programming help.
The only change you have to make is in current program,
where it says "your code goes here", do not make any changes to any
other files, they are just there to show you. This
code should be written for arbitrary data, not specifically for
this sequence of data. The only place you need to
write a code is marked YOUR CODE GOES HERE.
You have been supplied a file with data in it (data2.txt). The
line...
//I NEED THE PROGRAM IN C LANGUAGE!// QUESTION: I need you to write a program which manipulates text from an input file using the string library. Your program will accept command line arguments for the input and output file names as well as a list of blacklisted words. There are two major features in this programming: 1. Given an input file with text and a list of words, find and replace every use of these blacklisted words with the string...
C++ Programming Question: This programming assignment is intended to demonstrate your knowledge of the following: ▪ Writing a while loop ▪ Write functions and calling functions Text Processing [50 points] We would like to demonstrate our ability to control strings and use methods. There are times when a program has to search for and replace certain characters in a string with other characters. This program will look for an individual character, called the key character, inside a target string. It...
LINUX C programming Please make sure the output is correct Please do read data from file, the example below is just a example Third: Hash table (20 points) In this part, you will implement a hash table containing integers. The hash table has 10,000 buckets. An important part of a hash table is collision resolution. In this assignment, we want you to use chaining with a linked list to handle a collision. This means that if there is a collision...
C programming. please include comments
In this lab, you will learn to read data from and write data to a file - another use for pointers. SAMPLE PROGRAM There are two sample programs this week - WriteFile.c and ReadFile.c. The first, WriteFile.c, allows the user to enter customer names (first, middle, and last), and writes each name to an output text file, customerNames.txt. formatted as: firstName middlelnitial lastName" After you've run it once, what happens to the names you added...
I need help programming this question using C language. This program uses input data entered in command line at the same time when the command or .exe file is entered. They are called command-line arguments. Because everything entered in command line is taken as a string, these arguments including the command itself or the .exe file name are stored in an array of char pointers, each pointer points to the first character of a string (i.e., argument). The inputs can...
Using C programming For this project, you have been tasked to read a text file with student grades and perform several operations with them. First, you must read the file, loading the student records. Each record (line) contains the student’s identification number and then four of the student’s numerical test grades. Your application should find the average of the four grades and insert them into the same array as the id number and four grades. I suggest using a 5th...
Java programming How do i change this program to scan data from file and find the sum of the valid entry and count vaild and invalid entries The provided data file contains entries in the form ABCDE BB That is - a value ABCDE, followed by the base BB. Process this file, convert each to decimal (base 10) and determine the sum of the decimal (base 10) values. Reject any entry that is invalid. Report the sum of the values...