I wrote this program:
Code:
It is currently in the Files folder, inside the C folder that is in the Desktop. If I move the program.c file to the desktop, open it and run it with the compiler, an empty dest.c file (and the executable of the program) is created in the desktop. If I change orig.c's "rb" to "ab" the same happens to orig.c.
But if I don't, what is exactly happening to orig.c? Is it being created elsewhere as an empty file or, since it doesn't exist in the current folder, dest.c is an empty file? What is exactly happening here?
Code:
#include <stdio.h>
#include <stdlib.h>
main( )
{
FILE *fin = fopen("C:orig.c"," rb"), *fout = fopen("C:dest.c","ab") ;
int ch,x=1;
if ((fin==NULL) || (fout==NULL))
printf("%s\n",NULL);
while ((ch=fgetc(fin))!=EOF)
fputc(ch,fout);
while((ch = fgetc(fout))!=EOF)
putchar(ch);
fclose(fin);
fclose(fout);
}
It is currently in the Files folder, inside the C folder that is in the Desktop. If I move the program.c file to the desktop, open it and run it with the compiler, an empty dest.c file (and the executable of the program) is created in the desktop. If I change orig.c's "rb" to "ab" the same happens to orig.c.
But if I don't, what is exactly happening to orig.c? Is it being created elsewhere as an empty file or, since it doesn't exist in the current folder, dest.c is an empty file? What is exactly happening here?