well i managed to get a dynamically changing file name given a number (ie myfile_3.txt), using the sprintf thing,
however if i enter in a value > 99 i get different letters at the end of the .txt part (ie myfile_3.txa). i realize i have to allocate a correctly sized memory section for this but im not sure how to.
name = (char *)malloc(sizeof(INT_MAX+1));
sprintf(name, "myfile_%d.txt", number);