Article 4ZF7X C program: append variable in middle of string

C program: append variable in middle of string

by
justwantin
from LinuxQuestions.org on (#4ZF7X)
I am sure there is an answer to this and I do not know what the search words should be. I have a devices that may change number on reboots /boots I need to reset a command based on a device's number post boot.Code:int veml_devno = 1;

in_file = fopen("/sys/bus/iio/devices/iio:deviceveml_devno/in_uvindex_input", "r");In the example above I am appending the variable to 'device' and prepending it to '/'. Is this possible in C? I've used curly braces in Bash to do this. Having a second thought, should the variable be a char? But then it sill has to be inserted into the command.latest?d=yIl2AUoC8zA latest?i=vwzGPwj1760:JGUbyVj4Bms:F7zBnMy latest?i=vwzGPwj1760:JGUbyVj4Bms:V_sGLiP latest?d=qj6IDK7rITs latest?i=vwzGPwj1760:JGUbyVj4Bms:gIN9vFwvwzGPwj1760
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments