Challenge: Write the Contents of a File to Another File

Here is a simple coding challenge based on the concepts of file handling.

Problem statement #

Write a program that opens a file and writes all non-empty lines in that file to another file. The name of the new file can be based on the name of the original file. For example, if the original file is called foo.txt, the new file can be foo.txt.out.

Get hands-on with 1200+ tech skills courses.