Write a program that asks the user for a file containing a program and a name for an output file. Your program should then write the program, with line numbers to the output
Check out this question, it describes exactly what you're looking for. Let me know if you need more details.