int main() { char c,b; int i, count=0; FILE *fptr; //file data type. FILE *fptr2; fptr2=fopen("txtt.txt","a"); b=fgetc(fptr2); fprintf (fptr2, "hey"); fptr=fopen("text.txt","r");// assigns the adress of file to file pointer if(fptr==NULL)// checking if file exists and has permission rights. { fprintf(stdout,"No such file or directory\n"); exit(1); } while((c=fgetc(fptr))!=EOF) { //(c=fgetc(fptr));if i left this fgetc in I would get every othe char. // fgetc takes a file pointer for arg, so putting are fptr in the function and the declaring c as its val. this makes c = the first char in the file. Then, we loop getting the chars in the file until we get the end of the file fprintf(stdout,"%c",c); }//Then we printf all of the chars until the loop ends which is at end of file. fclose(fptr); //closing file return(0); }