Question: Can you check if it is right? my code is below. I just need to check if I am doing it right since I do
Can you check if it is right? my code is below. I just need to check if I am doing it right since I do not know how to compile. Please provide screenshot. I will make sure to thumbs up. Thank you!
#include
//reads phone_list.txt read = fopen("phone_list.txt", "r");
//creates phone_list.txt.cvt in writing mode write = fopen("phone_list.txt.cvt", "w"); if (read == NULL) printf("No file"); else { // while loop until end of file is reached while (!feof(read)) { // scans from read, in string format, and into words fscanf(read, "%s",words);
//calls the conversion function conversion(words,phoneNo); // prints from write pointer and prints phone number fprintf(write,"%s ",phoneNo); } } /* closing Input */ fclose(read); /* closing Output */ fclose(write);
//terminates return 0; }
phone_list.txt is the following:
TAKEOUT HAIRCUT THEBOSS BEERCAN PETCARE CARWASH MATHHLP ABAGAIL GROOMER CLEANER DAYCARE AIRPORT NUMBERS ROSELYN LETTERS MUSEUMS PROGRAM RUDOLPH LYNDSAY
and the output is supposed to be:
echo 'Expected:' echo 'Enter file name: phone_list.txt' echo 'Output file name: phone_list.txt.cvt' echo '8253688' echo '4247288' echo '8432677' echo '2337226' echo '7382273' echo '2279274' echo '6284457' echo '2224245' echo '4766637' echo '2532637' echo '3292273' echo '2477678' echo '6862377' echo '7673596' echo '5388377' echo '6873867' echo '7764726' echo '7836574'
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
