Question 2: Assume that there exists a file named “aFile.txt…
Question 2: Assume that there exists a file named “aFile.txt” in the local disk. Write a program that prompts the user for a positive integer n as an input. The program should write the first n characters of each line in “aFile.txt” to a new file, named “newFile.txt”. The program should write the entire line, if n is greater than that line’s length. Below is a sample input and output for n = 10. Input – aFile.txt: First line of the file Second line of the file Third Output – newFile.txt: First line Second lin Third
Read Details