simple c program
Budget: $10 – $30 USD
Suppose you are given files containing a paragraph that are separated into lines. Write a program to remove the
newline characters in the paragraph and replace with white spaces and store it in the output file.
Example input/output:
Enter the file name: message1.txt
Output file name: new_message1.txt
1) Name your program project6_paragraph.c
2) The output file name should be the same name but an added new_ at the beginning. Assume the
input file name is no more than 100 characters. Assume the length of each line in the input file is no
more than 10000 characters.
3) Use fgets function to read from the input file.
4) The program should include the following function:
void convert(char *s1, char *s2);
The function expects s1 to point to a string containing a line in the input file, s2 to point to a string
storing the content in s1 after the removing the newline character and replacing with a white space.
This function should use pointer arithmetic– not subscripting – to visit array elements. In other
words, eliminate the loop index variables and all use of the [] operator in the function.
5) String library functions are NOT allowed in the convert function.
6) String library functions are allowed in the main function.
newline characters in the paragraph and replace with white spaces and store it in the output file.
Example input/output:
Enter the file name: message1.txt
Output file name: new_message1.txt
1) Name your program project6_paragraph.c
2) The output file name should be the same name but an added new_ at the beginning. Assume the
input file name is no more than 100 characters. Assume the length of each line in the input file is no
more than 10000 characters.
3) Use fgets function to read from the input file.
4) The program should include the following function:
void convert(char *s1, char *s2);
The function expects s1 to point to a string containing a line in the input file, s2 to point to a string
storing the content in s1 after the removing the newline character and replacing with a white space.
This function should use pointer arithmetic– not subscripting – to visit array elements. In other
words, eliminate the loop index variables and all use of the [] operator in the function.
5) String library functions are NOT allowed in the convert function.
6) String library functions are allowed in the main function.