I am trying to send a command to a Linux command line from a C program and there is one part I am not sure how to do.
For example in my C code I have
system("raspistill -o image.jpg");
What I would like to be able to do is add a number to the end of "image" and increment it every time the program runs, but how can I pass in a variable n
to the system()
function that is only looking for a const char
?
I tried this but it did not work:
char fileName = ("raspistill -o image%d.jpg",n);
system(filename);
I've tried searching on this and haven't found anything about how to add a variable to it. Sorry for the noob question.