Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is my code (count.c program) jabberwocky.txt 'Twas brillig, and the slithy toves Did gyre and gimble in the wabe: All mimsy were the borogoves,

This is my code (count.c program)

image text in transcribed

jabberwocky.txt

'Twas brillig, and the slithy toves Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe.

"Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch!"

He took his vorpal sword in hand: Long time the manxome foe he sought- So rested he by the Tumtum tree, And stood awhile in thought.

And, as in uffish thought he stood, The Jabberwock, with eyes of flame, Came wiffling through the tulgey wood, And burbled as it came!

One, two! One, two! And through and through The vorpal blade went snicker-snack! He left it dead, and with its head He went galumphing back.

"And hast thou slain the Jabberwock? Come to my arms, my beamish boy! O frabjous day! Callooh! Callay!" He chortled in his joy.

'Twas brillig, and the slithy toves Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe.

Please know that my code is working. I provided the code and .txt. I do not know how how to figure out to work the program correctly according to the assignment requirement below.

image text in transcribed

#include #include // ANSI C exit () prototype #include // strchr() prototype #define SLEN 81 char * s_gets (char st, int n) int main void) int ch; FILE *fp; long count 0; char filename [SLEN] // place to store each character as read I/ "file pointer" printf("Enter file name:"); s_gets(filename, SLEN) if ((fp = fopen(filename, "r")) = NULL) printf( "can't open %s ", exit (EXIT_FAILURE); filename); while ((ch= getc(fp)) != E0F) putchar(ch) count++ fclose(fp); printf( "File %s return 0; %ld characters ", filename, count); char * s_gets (char st, int n) char * ret_val; char * find; ret_val = fgets(st, n, stdin ) ; if (ret_val) . .); find = strchr(st, if (find) // look for newline // if the address is not NULL // place a null character there *find '10' else (getchar() continue; while != . .) return ret_val; #include #include // ANSI C exit () prototype #include // strchr() prototype #define SLEN 81 char * s_gets (char st, int n) int main void) int ch; FILE *fp; long count 0; char filename [SLEN] // place to store each character as read I/ "file pointer" printf("Enter file name:"); s_gets(filename, SLEN) if ((fp = fopen(filename, "r")) = NULL) printf( "can't open %s ", exit (EXIT_FAILURE); filename); while ((ch= getc(fp)) != E0F) putchar(ch) count++ fclose(fp); printf( "File %s return 0; %ld characters ", filename, count); char * s_gets (char st, int n) char * ret_val; char * find; ret_val = fgets(st, n, stdin ) ; if (ret_val) . .); find = strchr(st, if (find) // look for newline // if the address is not NULL // place a null character there *find '10' else (getchar() continue; while != . .) return ret_val

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

1. How do media shape our thinking?

Answered: 1 week ago