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; }

11th Apr 2021, 10:05 AM
Yobe Auwal
Yobe Auwal - avatar
7 Respuestas
+ 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.
13th Apr 2021, 5:18 AM
Alice J Petey
Alice J Petey - avatar
+ 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.
11th Apr 2021, 11:04 AM
#0009e7 [get]
#0009e7 [get] - avatar
+ 3
Thank you. But say it's c and the errors you detected are corrected what would be the final result?
11th Apr 2021, 11:49 AM
Yobe Auwal
Yobe Auwal - avatar
+ 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.
11th Apr 2021, 2:31 PM
#0009e7 [get]
#0009e7 [get] - avatar
+ 2
in c every keyword and every word are in lower case letters not upper case letters.
12th Apr 2021, 12:32 PM
A J
A J - avatar
+ 1
I admit it was an exam i have already written. Thank you very much for your help.
11th Apr 2021, 3:17 PM
Yobe Auwal
Yobe Auwal - avatar
0
What did you mean by "SEEK-WR"? There are only SEEK_CUR, SEEK_END and SEEK_SET in stdio.h.
11th Apr 2021, 2:19 PM
#0009e7 [get]
#0009e7 [get] - avatar