Say I have a file pointer like this:
file_ptr = fopen(“test.txt”, “r+”);
and I want to change each char
's ASCII value as I move through the stream (I am doing this as a cipher, so if there is a better or more efficient way to do this, please let me know).
I am trying to use a while(!feof(file_ptr)) {}
loop with fgetc()
and fputc
, but the file_ptr
will be pointing to the next char, so i want to know if there is something i can do point it backwards one spot.
Essentially, I want to know the file stream equivalent for:
char* blah="blah blah";
char* index=blah;
index++;/*how to navigate a file stream in this way*/