I want to set a placeholder value (type int) of a path:
/sys/class/gpio/gpio%d/value => /sys/class/gpio/gpio33/value
The inserted value is maximum 99 and minimum 1. Because I do not want any empty chars in my path I would like to have the buffer size determined automatically.
This is why I thought of asprintf() which does this for strings unfortunately it does not work with integers.
#define GPIO_PATH_VALUE "/sys/class/gpio/gpio%d/value"
char * path;
asprintf(path, GPIO_PATH_VALUE, 4);
asprintf(path, GPIO_PATH_VALUE, 67);
Is there a function similar to asprintf() which works with integers?
Bodo
asprintfas&path. Linux/gcc-4.7char **