Question: 1 0 . 1 0 LAB: File name change A photographer is organizing a photo collection about the national parks in the US and would
LAB: File name change
A photographer is organizing a photo collection about the national parks in the US and would like to annotate the information about each of
the photos into a separate set of files. Write a program that reads the name of a text file containing a list of photo file names. The program
then reads the photo file names from the text file, replaces the photo.jpg portion of the file names with info.txt and outputs the
modified file names.
Assume the unchanged portion of the photo file names contains only letters and numbers, and the text file stores one photo file name per
line. If the text file is empty, the program produces no output.
Ex: If the input of the program is:
ParkPhotos.txt
and the contents of ParkPhotos.txt are:
Acadiaphoto.jpg
AmericanSamoaphoto.jpg
BlackCanyonoftheGunnisonphoto.jpg
CarlsbadCavernsphoto.jpg
CraterLakephoto.jpg
GrandCanyonphoto.jpg
IndianaDunesphoto.jpg
LakeClarkphoto.jpg
Redwoodphoto.jpg
VirginIslandsphoto.jpg
Voyageursphoto.jpg
WrangellStEliasphoto.jpg
the output of the program is:
Acadiainfo.txt
AmericanSamoainfo.txt
BlackCanyonoftheGunnisoninfo.txt
CarlsbadCavernsinfo.txt
CraterLakeinfo.txt
GrandCanyoninfo.txt
IndianaDunesinfo.txt
Lakeclarkinfo.txt
Redwoodinfo.txt
VirginIslandsinfo.txt
Voyageursinfo.txt
WrangellStEliasinfo.txt
In C please.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
