I am using a while loop that saves the data each time the loop is run into a different file name each time.
I am using shift registers to create a number that starts with 0 on the first loop and adds 1 to it each time the loop is run. So 0,1,2,3........ This is pretty straight forward and works correctly.
At the start I enter a string that then gets the nummber (string) appended to it and this is used to give the name of the file that is saved. I run into a problem when the number exceeds 255 as the string then returns the same value as the first one. Example shown below.
original string: "test"
1st loop: "test_0"
2nd loop: "test_1" ..................
256th loop: "test_255"
257th loop: "test_0"
Now I have thought about using dividing the number in the loop by 256 and rounding down. Then convert this number to string and append. This will limit me to 256 x 256 files but this is fine with me. Exampe below to make it clearer.
1st loop: "test_0_0"
2nd loop: "test_0_1" ..................
255th loop: "test_0_255"
256th loop: "test_1_0"
Are there any better ways to do this?