I'm relatively new to C, coming from python mainly and I want to be able to create a new variable as a string to use the function strcat() based of an integer. For example, if each time I loop through it and increment an integer, 1, a new variable that is a string/char is now "1", and 2, "2" and so on, so that when using strcat(dest, value), it makes a string for example called: (1st loop) "TEST1.txt", (2nd loop) "TEST2.txt" and so on. If this doesn't really make sense, the best way I can describe this is in python, to achieve the exact same thing, say:
a = 1
while True:
file = open("Test" + str(a) + ".txt", "w")
file.close()
a += 1
if a == 10:
break
I know how to do it with strings, for example if a isn't an integer, from the python code to do the "Test" + str(a) in c, i can do:
char* a = "test";
char* b = "1";
strcat(a, b);
if i print that i would get "test1", but I need it to be an integer first then a string so that i can increment it, thanks