While playing around with sprintf to figure out how to make it work before adding it to my recover.c code, I ran into a weird (at least for me) situation.
I declare a counter variable (int type), use this variable as an argument for sprintf and, as far as I can tell, successfully create a filename using the output of sprintf. However, when I printf the value of my counter variable (for sanity check), the value of my counter variable has been modified to a super-long number... It is unclear to me WHY sprintf has any effect on the counter and how I can return the counter to be what it used to be (e.g., to add 1 in order to rename the next file appropriately.
My test code is available in this link. Any input will be greatly appreciated!