So I was wondering, how can I read only a part of a text file.
There are modes read, write, append, and binary mode. Which one do I use? and how?
Like for example:
so how do I read onlyCode:Jack and Jill went up the hill to get a bucket of water they ran down the hill and fell together.
Do I use? : (This simply prints ALL the texts in Sample.txt)Code:to get a bucket of water
Code:FILE *fp; char ch; if( (fp = fopen("Sample.txt", "r")) == NULL) fprintf("stderr, "ERROR: Sample.txt does not exist.\n"); while( (fscanf(fp, "%c", &ch)) == 1) fprintf(stdout, "%c", ch); fclose(fp);