What would be the output please????? | Sololearn: Learn to code for FREE!

0

What would be the output please?????

On running this program what would be the contents of the 'target.txt' file? If the source file contains "Behold I Am Doing A New Thing In Your Life" #include <stdio.h> Int main() { Int i, fss; Char Ch, source[20] = "Source.txt", target[20] = "target.txt".t; FILE *fs, *ft; fs = fopen (source, "r"); ft = fopen (target, "w"); While(1) { Ch = get C(fs); If(Ch == EOF) Break; Else { fseek (fs, 4L, SEEK-WR); fput C(Ch, ft); } } Return 0; }

c

4/11/2021 10:05:15 AM

Yobe Auwal

7 Answers

New Answer

+8

C is a case-sensitive programming language. And all the built-in functions contains only lower case letters. Ex- You should write if instead of If.

+6

1. This code contains errors like first capital letter inkeywords, get C instead of getc, so it will fail. 2. It is C, not Java.

+3

Thank you. But say it's c and the errors you detected are corrected what would be the final result?

+2

With SEEK_CUR, it would be "BdmnNhIuf" (as there are 4 bits/ASCII characters from the next to read charcter skipped in each iteration). With SEEK_END, it would be "B" (as after reading the first character the file position pointer is set to 4 bits after the end of the file and in the second iteration EOF is returned). With SEEK_SET, it would be infinite/until-overflow loop (as in each iteration the file position pointer is set to 4 bits after the start of the file). And is not it the homework assignment? If yes, please, do not post assignments. If really needed, ask us for explanation.

+2

in c every keyword and every word are in lower case letters not upper case letters.

+1

I admit it was an exam i have already written. Thank you very much for your help.

0

What did you mean by "SEEK-WR"? There are only SEEK_CUR, SEEK_END and SEEK_SET in stdio.h.